create-berna-stencil 1.0.14 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eleventy.js +1 -1
- package/.gitignore +2 -1
- package/bin/create.js +1 -1
- package/package.json +7 -6
- package/src/api/core/composer.json +1 -2
- package/src/api/core/vendor/autoload.php +1 -1
- package/src/api/core/vendor/composer/autoload_real.php +5 -5
- package/src/api/core/vendor/composer/autoload_static.php +15 -15
- package/src/api/core/vendor/composer/installed.json +7 -7
- package/src/api/core/vendor/composer/installed.php +2 -2
- package/src/api/core/vendor/graham-campbell/result-type/LICENSE +21 -21
- package/src/api/core/vendor/graham-campbell/result-type/composer.json +33 -33
- package/src/api/core/vendor/graham-campbell/result-type/src/Error.php +121 -121
- package/src/api/core/vendor/graham-campbell/result-type/src/Result.php +69 -69
- package/src/api/core/vendor/graham-campbell/result-type/src/Success.php +120 -120
- package/src/api/core/vendor/phpmailer/phpmailer/COMMITMENT +46 -46
- package/src/api/core/vendor/phpmailer/phpmailer/LICENSE +501 -501
- package/src/api/core/vendor/phpmailer/phpmailer/README.md +232 -232
- package/src/api/core/vendor/phpmailer/phpmailer/SECURITY.md +37 -37
- package/src/api/core/vendor/phpmailer/phpmailer/SMTPUTF8.md +48 -48
- package/src/api/core/vendor/phpmailer/phpmailer/VERSION +1 -1
- package/src/api/core/vendor/phpmailer/phpmailer/composer.json +84 -84
- package/src/api/core/vendor/phpmailer/phpmailer/get_oauth_token.php +182 -182
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-af.php +26 -26
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ar.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-as.php +35 -35
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-az.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ba.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-be.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-bg.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-bn.php +35 -35
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ca.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-cs.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-da.php +39 -39
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-de.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-el.php +33 -33
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-eo.php +37 -37
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php +38 -38
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-et.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-fa.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-fo.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php +36 -36
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-gl.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-he.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-hi.php +35 -35
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-hr.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-hu.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-hy.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-id.php +31 -31
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-it.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ja.php +37 -37
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ka.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ko.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ku.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-lt.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-lv.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-mg.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-mn.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ms.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-nb.php +37 -37
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-nl.php +38 -38
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-pl.php +33 -33
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt.php +34 -34
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt_br.php +38 -38
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ro.php +33 -33
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ru.php +36 -36
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-si.php +34 -34
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-sk.php +30 -30
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-sl.php +36 -36
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-sr.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-sr_latn.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-sv.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-tl.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php +38 -38
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-uk.php +28 -28
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ur.php +30 -30
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-vi.php +27 -27
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh.php +29 -29
- package/src/api/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php +36 -36
- package/src/api/core/vendor/phpmailer/phpmailer/src/DSNConfigurator.php +245 -245
- package/src/api/core/vendor/phpmailer/phpmailer/src/Exception.php +40 -40
- package/src/api/core/vendor/phpmailer/phpmailer/src/OAuth.php +139 -139
- package/src/api/core/vendor/phpmailer/phpmailer/src/OAuthTokenProvider.php +44 -44
- package/src/api/core/vendor/phpmailer/phpmailer/src/PHPMailer.php +5525 -5525
- package/src/api/core/vendor/phpmailer/phpmailer/src/POP3.php +470 -470
- package/src/api/core/vendor/phpmailer/phpmailer/src/SMTP.php +1617 -1617
- package/src/api/core/vendor/phpoption/phpoption/LICENSE +200 -200
- package/src/api/core/vendor/phpoption/phpoption/composer.json +50 -50
- package/src/api/core/vendor/phpoption/phpoption/src/PhpOption/LazyOption.php +175 -175
- package/src/api/core/vendor/phpoption/phpoption/src/PhpOption/None.php +136 -136
- package/src/api/core/vendor/phpoption/phpoption/src/PhpOption/Option.php +434 -434
- package/src/api/core/vendor/phpoption/phpoption/src/PhpOption/Some.php +169 -169
- package/src/api/core/vendor/symfony/polyfill-ctype/Ctype.php +232 -232
- package/src/api/core/vendor/symfony/polyfill-ctype/LICENSE +19 -19
- package/src/api/core/vendor/symfony/polyfill-ctype/README.md +12 -12
- package/src/api/core/vendor/symfony/polyfill-ctype/bootstrap.php +50 -50
- package/src/api/core/vendor/symfony/polyfill-ctype/bootstrap80.php +46 -46
- package/src/api/core/vendor/symfony/polyfill-ctype/composer.json +38 -38
- package/src/api/core/vendor/symfony/polyfill-mbstring/LICENSE +19 -19
- package/src/api/core/vendor/symfony/polyfill-mbstring/Mbstring.php +1077 -1077
- package/src/api/core/vendor/symfony/polyfill-mbstring/README.md +13 -13
- package/src/api/core/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php +119 -119
- package/src/api/core/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php +1397 -1397
- package/src/api/core/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php +5 -5
- package/src/api/core/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php +1489 -1489
- package/src/api/core/vendor/symfony/polyfill-mbstring/bootstrap.php +171 -171
- package/src/api/core/vendor/symfony/polyfill-mbstring/bootstrap80.php +167 -167
- package/src/api/core/vendor/symfony/polyfill-mbstring/composer.json +39 -39
- package/src/api/core/vendor/symfony/polyfill-php80/LICENSE +19 -19
- package/src/api/core/vendor/symfony/polyfill-php80/Php80.php +115 -115
- package/src/api/core/vendor/symfony/polyfill-php80/PhpToken.php +106 -106
- package/src/api/core/vendor/symfony/polyfill-php80/README.md +25 -25
- package/src/api/core/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php +31 -31
- package/src/api/core/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php +16 -16
- package/src/api/core/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php +20 -20
- package/src/api/core/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php +16 -16
- package/src/api/core/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php +16 -16
- package/src/api/core/vendor/symfony/polyfill-php80/bootstrap.php +42 -42
- package/src/api/core/vendor/symfony/polyfill-php80/composer.json +37 -37
- package/src/api/core/vendor/vlucas/phpdotenv/LICENSE +30 -30
- package/src/api/core/vendor/vlucas/phpdotenv/composer.json +60 -60
- package/src/api/core/vendor/vlucas/phpdotenv/src/Dotenv.php +267 -267
- package/src/api/core/vendor/vlucas/phpdotenv/src/Exception/ExceptionInterface.php +12 -12
- package/src/api/core/vendor/vlucas/phpdotenv/src/Exception/InvalidEncodingException.php +12 -12
- package/src/api/core/vendor/vlucas/phpdotenv/src/Exception/InvalidFileException.php +12 -12
- package/src/api/core/vendor/vlucas/phpdotenv/src/Exception/InvalidPathException.php +12 -12
- package/src/api/core/vendor/vlucas/phpdotenv/src/Exception/ValidationException.php +12 -12
- package/src/api/core/vendor/vlucas/phpdotenv/src/Loader/Loader.php +48 -48
- package/src/api/core/vendor/vlucas/phpdotenv/src/Loader/LoaderInterface.php +20 -20
- package/src/api/core/vendor/vlucas/phpdotenv/src/Loader/Resolver.php +65 -65
- package/src/api/core/vendor/vlucas/phpdotenv/src/Parser/Entry.php +59 -59
- package/src/api/core/vendor/vlucas/phpdotenv/src/Parser/EntryParser.php +299 -299
- package/src/api/core/vendor/vlucas/phpdotenv/src/Parser/Lexer.php +58 -58
- package/src/api/core/vendor/vlucas/phpdotenv/src/Parser/Lines.php +127 -127
- package/src/api/core/vendor/vlucas/phpdotenv/src/Parser/Parser.php +53 -53
- package/src/api/core/vendor/vlucas/phpdotenv/src/Parser/ParserInterface.php +19 -19
- package/src/api/core/vendor/vlucas/phpdotenv/src/Parser/Value.php +88 -88
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/AdapterInterface.php +15 -15
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ApacheAdapter.php +89 -89
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ArrayAdapter.php +80 -80
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/EnvConstAdapter.php +88 -88
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/GuardedWriter.php +85 -85
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ImmutableWriter.php +110 -110
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/MultiReader.php +48 -48
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/MultiWriter.php +64 -64
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/PutenvAdapter.php +91 -91
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ReaderInterface.php +17 -17
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ReplacingWriter.php +104 -104
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ServerConstAdapter.php +88 -88
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/Adapter/WriterInterface.php +27 -27
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/AdapterRepository.php +107 -107
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/RepositoryBuilder.php +272 -272
- package/src/api/core/vendor/vlucas/phpdotenv/src/Repository/RepositoryInterface.php +51 -51
- package/src/api/core/vendor/vlucas/phpdotenv/src/Store/File/Paths.php +44 -44
- package/src/api/core/vendor/vlucas/phpdotenv/src/Store/File/Reader.php +81 -81
- package/src/api/core/vendor/vlucas/phpdotenv/src/Store/FileStore.php +72 -72
- package/src/api/core/vendor/vlucas/phpdotenv/src/Store/StoreBuilder.php +141 -141
- package/src/api/core/vendor/vlucas/phpdotenv/src/Store/StoreInterface.php +17 -17
- package/src/api/core/vendor/vlucas/phpdotenv/src/Store/StringStore.php +37 -37
- package/src/api/core/vendor/vlucas/phpdotenv/src/Util/Regex.php +112 -112
- package/src/api/core/vendor/vlucas/phpdotenv/src/Util/Str.php +108 -108
- package/src/api/core/vendor/vlucas/phpdotenv/src/Validator.php +207 -207
- package/src/api/endpoints/protected/{secret.php → prova-chiusa.php} +1 -1
- package/src/api/endpoints/public/{ping.php → prova-aperta.php} +1 -1
- package/src/api/core/vendor/graham-campbell/result-type/.gitattributes +0 -9
- package/src/api/core/vendor/graham-campbell/result-type/.github/CODE_OF_CONDUCT.md +0 -132
- package/src/api/core/vendor/graham-campbell/result-type/.github/CONTRIBUTING.md +0 -31
- package/src/api/core/vendor/graham-campbell/result-type/.github/FUNDING.yml +0 -2
- package/src/api/core/vendor/graham-campbell/result-type/.github/SECURITY.md +0 -14
- package/src/api/core/vendor/graham-campbell/result-type/.github/workflows/stale.yml +0 -11
- package/src/api/core/vendor/graham-campbell/result-type/.github/workflows/tests.yml +0 -40
- package/src/api/core/vendor/graham-campbell/result-type/CHANGELOG.md +0 -53
- package/src/api/core/vendor/graham-campbell/result-type/README.md +0 -42
- package/src/api/core/vendor/graham-campbell/result-type/phpunit.xml.dist +0 -13
- package/src/api/core/vendor/graham-campbell/result-type/tests/ResultTest.php +0 -95
- package/src/api/core/vendor/phpmailer/phpmailer/.codecov.yml +0 -21
- package/src/api/core/vendor/phpmailer/phpmailer/.editorconfig +0 -15
- package/src/api/core/vendor/phpmailer/phpmailer/.gitattributes +0 -17
- package/src/api/core/vendor/phpmailer/phpmailer/.github/FUNDING.yml +0 -6
- package/src/api/core/vendor/phpmailer/phpmailer/.github/ISSUE_TEMPLATE/bug_report.md +0 -23
- package/src/api/core/vendor/phpmailer/phpmailer/.github/actions/build-docs/Dockerfile +0 -15
- package/src/api/core/vendor/phpmailer/phpmailer/.github/actions/build-docs/entrypoint.sh +0 -5
- package/src/api/core/vendor/phpmailer/phpmailer/.github/dependabot.yml +0 -21
- package/src/api/core/vendor/phpmailer/phpmailer/.github/workflows/docs.yaml +0 -30
- package/src/api/core/vendor/phpmailer/phpmailer/.github/workflows/scorecards.yml +0 -61
- package/src/api/core/vendor/phpmailer/phpmailer/.github/workflows/tests.yml +0 -237
- package/src/api/core/vendor/phpmailer/phpmailer/.phan/config.php +0 -41
- package/src/api/core/vendor/phpmailer/phpmailer/UPGRADING.md +0 -125
- package/src/api/core/vendor/phpmailer/phpmailer/changelog.md +0 -1122
- package/src/api/core/vendor/phpmailer/phpmailer/docs/README.md +0 -9
- package/src/api/core/vendor/phpmailer/phpmailer/examples/DKIM_gen_keys.phps +0 -81
- package/src/api/core/vendor/phpmailer/phpmailer/examples/DKIM_sign.phps +0 -46
- package/src/api/core/vendor/phpmailer/phpmailer/examples/README.md +0 -96
- package/src/api/core/vendor/phpmailer/phpmailer/examples/azure_xoauth2.phps +0 -126
- package/src/api/core/vendor/phpmailer/phpmailer/examples/callback.phps +0 -76
- package/src/api/core/vendor/phpmailer/phpmailer/examples/contactform-ajax.phps +0 -146
- package/src/api/core/vendor/phpmailer/phpmailer/examples/contactform.phps +0 -95
- package/src/api/core/vendor/phpmailer/phpmailer/examples/contents.html +0 -17
- package/src/api/core/vendor/phpmailer/phpmailer/examples/contentsutf8.html +0 -23
- package/src/api/core/vendor/phpmailer/phpmailer/examples/exceptions.phps +0 -40
- package/src/api/core/vendor/phpmailer/phpmailer/examples/extending.phps +0 -72
- package/src/api/core/vendor/phpmailer/phpmailer/examples/gmail.phps +0 -106
- package/src/api/core/vendor/phpmailer/phpmailer/examples/gmail_xoauth.phps +0 -121
- package/src/api/core/vendor/phpmailer/phpmailer/examples/images/PHPMailer card logo.afdesign +0 -0
- package/src/api/core/vendor/phpmailer/phpmailer/examples/images/PHPMailer card logo.png +0 -0
- package/src/api/core/vendor/phpmailer/phpmailer/examples/images/PHPMailer card logo.svg +0 -209
- package/src/api/core/vendor/phpmailer/phpmailer/examples/images/phpmailer.png +0 -0
- package/src/api/core/vendor/phpmailer/phpmailer/examples/images/phpmailer_mini.png +0 -0
- package/src/api/core/vendor/phpmailer/phpmailer/examples/mail.phps +0 -35
- package/src/api/core/vendor/phpmailer/phpmailer/examples/mailing_list.phps +0 -96
- package/src/api/core/vendor/phpmailer/phpmailer/examples/pop_before_smtp.phps +0 -60
- package/src/api/core/vendor/phpmailer/phpmailer/examples/send_file_upload.phps +0 -60
- package/src/api/core/vendor/phpmailer/phpmailer/examples/send_multiple_file_upload.phps +0 -60
- package/src/api/core/vendor/phpmailer/phpmailer/examples/sendmail.phps +0 -37
- package/src/api/core/vendor/phpmailer/phpmailer/examples/sendoauth2.phps +0 -100
- package/src/api/core/vendor/phpmailer/phpmailer/examples/simple_contact_form.phps +0 -102
- package/src/api/core/vendor/phpmailer/phpmailer/examples/smime_signed_mail.phps +0 -99
- package/src/api/core/vendor/phpmailer/phpmailer/examples/smtp.phps +0 -62
- package/src/api/core/vendor/phpmailer/phpmailer/examples/smtp_check.phps +0 -60
- package/src/api/core/vendor/phpmailer/phpmailer/examples/smtp_low_memory.phps +0 -117
- package/src/api/core/vendor/phpmailer/phpmailer/examples/smtp_no_auth.phps +0 -53
- package/src/api/core/vendor/phpmailer/phpmailer/examples/ssl_options.phps +0 -81
- package/src/api/core/vendor/phpmailer/phpmailer/phpcs.xml.dist +0 -52
- package/src/api/core/vendor/phpmailer/phpmailer/phpdoc.dist.xml +0 -20
- package/src/api/core/vendor/phpmailer/phpmailer/phpunit.xml.dist +0 -36
- package/src/api/core/vendor/phpmailer/phpmailer/test/DebugLogTestListener.php +0 -47
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/FileIsAccessibleTest/accessible.txt +0 -1
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/FileIsAccessibleTest/inaccessible.txt +0 -1
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-fr.php +0 -10
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-nl.php +0 -10
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xa_scri_cc.php +0 -9
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xb_scri.php +0 -9
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xc_cc.php +0 -9
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xd_cc.php +0 -9
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xd_scri.php +0 -9
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xe.php +0 -9
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-xx.php +0 -9
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-yy.php +0 -16
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-yz.php +0 -16
- package/src/api/core/vendor/phpmailer/phpmailer/test/Fixtures/LocalizationTest/phpmailer.lang-zz.php +0 -20
- package/src/api/core/vendor/phpmailer/phpmailer/test/Language/TranslationCompletenessTest.php +0 -97
- package/src/api/core/vendor/phpmailer/phpmailer/test/OAuth/OAuthTest.php +0 -76
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/AddEmbeddedImageTest.php +0 -178
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/AddStringAttachmentTest.php +0 -147
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/AddStringEmbeddedImageTest.php +0 -161
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/AddrFormatTest.php +0 -70
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/AuthCRAMMD5Test.php +0 -48
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/CustomHeaderTest.php +0 -285
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/DKIMTest.php +0 -258
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/DKIMWithoutExceptionsTest.php +0 -46
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/DSNConfiguratorTest.php +0 -221
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/EncodeQTest.php +0 -110
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/EncodeStringTest.php +0 -135
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/FileIsAccessibleTest.php +0 -103
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/FilenameToTypeTest.php +0 -74
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/GenerateIdTest.php +0 -75
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/GetLastMessageIDTest.php +0 -110
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/HasLineLongerThanMaxTest.php +0 -158
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/Html2TextTest.php +0 -231
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/ICalTest.php +0 -126
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/IsPermittedPathTest.php +0 -108
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/IsValidHostTest.php +0 -107
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/LocalizationTest.php +0 -505
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/MailTransportTest.php +0 -261
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/MbPathinfoTest.php +0 -171
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/MimeTypesTest.php +0 -70
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/NormalizeBreaksTest.php +0 -111
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/PHPMailerTest.php +0 -1388
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/ParseAddressesTest.php +0 -321
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/PunyencodeAddressTest.php +0 -141
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/QuotedStringTest.php +0 -70
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/ReplyToGetSetClearTest.php +0 -444
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/SetErrorTest.php +0 -154
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/SetFromTest.php +0 -202
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/SetTest.php +0 -81
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/SetWordWrapTest.php +0 -120
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/Utf8CharBoundaryTest.php +0 -66
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/ValidateAddressCustomValidatorTest.php +0 -116
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/ValidateAddressTest.php +0 -485
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/WrapTextTest.php +0 -125
- package/src/api/core/vendor/phpmailer/phpmailer/test/PHPMailer/XMailerTest.php +0 -75
- package/src/api/core/vendor/phpmailer/phpmailer/test/POP3/PopBeforeSmtpTest.php +0 -139
- package/src/api/core/vendor/phpmailer/phpmailer/test/PreSendTestCase.php +0 -46
- package/src/api/core/vendor/phpmailer/phpmailer/test/Security/DenialOfServiceVectorsTest.php +0 -52
- package/src/api/core/vendor/phpmailer/phpmailer/test/SendTestCase.php +0 -126
- package/src/api/core/vendor/phpmailer/phpmailer/test/TestCase.php +0 -392
- package/src/api/core/vendor/phpmailer/phpmailer/test/fakepopserver.sh +0 -126
- package/src/api/core/vendor/phpmailer/phpmailer/test/fakesendmail.sh +0 -22
- package/src/api/core/vendor/phpmailer/phpmailer/test/runfakepopserver.sh +0 -12
- package/src/api/core/vendor/phpmailer/phpmailer/test/testbootstrap-dist.php +0 -8
- package/src/api/core/vendor/phpmailer/phpmailer/test/validators.php +0 -12
- package/src/api/core/vendor/phpoption/phpoption/.gitattributes +0 -13
- package/src/api/core/vendor/phpoption/phpoption/.github/CODE_OF_CONDUCT.md +0 -132
- package/src/api/core/vendor/phpoption/phpoption/.github/CONTRIBUTING.md +0 -30
- package/src/api/core/vendor/phpoption/phpoption/.github/FUNDING.yml +0 -2
- package/src/api/core/vendor/phpoption/phpoption/.github/SECURITY.md +0 -14
- package/src/api/core/vendor/phpoption/phpoption/.github/workflows/static.yml +0 -40
- package/src/api/core/vendor/phpoption/phpoption/.github/workflows/tests.yml +0 -40
- package/src/api/core/vendor/phpoption/phpoption/Makefile +0 -17
- package/src/api/core/vendor/phpoption/phpoption/README.md +0 -201
- package/src/api/core/vendor/phpoption/phpoption/phpstan-baseline.neon +0 -44
- package/src/api/core/vendor/phpoption/phpoption/phpstan.neon.dist +0 -7
- package/src/api/core/vendor/phpoption/phpoption/phpunit.xml.dist +0 -13
- package/src/api/core/vendor/phpoption/phpoption/tests/PhpOption/Tests/EnsureTest.php +0 -72
- package/src/api/core/vendor/phpoption/phpoption/tests/PhpOption/Tests/LazyOptionTest.php +0 -357
- package/src/api/core/vendor/phpoption/phpoption/tests/PhpOption/Tests/NoneTest.php +0 -153
- package/src/api/core/vendor/phpoption/phpoption/tests/PhpOption/Tests/OptionTest.php +0 -166
- package/src/api/core/vendor/phpoption/phpoption/tests/PhpOption/Tests/SomeTest.php +0 -194
- package/src/api/core/vendor/phpoption/phpoption/tests/bootstrap.php +0 -8
- package/src/api/core/vendor/phpoption/phpoption/vendor-bin/phpstan/composer.json +0 -8
- package/src/api/core/vendor/vlucas/phpdotenv/.editorconfig +0 -15
- package/src/api/core/vendor/vlucas/phpdotenv/.gitattributes +0 -15
- package/src/api/core/vendor/vlucas/phpdotenv/.github/CODE_OF_CONDUCT.md +0 -132
- package/src/api/core/vendor/vlucas/phpdotenv/.github/CONTRIBUTING.md +0 -30
- package/src/api/core/vendor/vlucas/phpdotenv/.github/FUNDING.yml +0 -2
- package/src/api/core/vendor/vlucas/phpdotenv/.github/SECURITY.md +0 -14
- package/src/api/core/vendor/vlucas/phpdotenv/.github/workflows/static.yml +0 -40
- package/src/api/core/vendor/vlucas/phpdotenv/.github/workflows/tests.yml +0 -70
- package/src/api/core/vendor/vlucas/phpdotenv/Makefile +0 -17
- package/src/api/core/vendor/vlucas/phpdotenv/README.md +0 -370
- package/src/api/core/vendor/vlucas/phpdotenv/UPGRADING.md +0 -196
- package/src/api/core/vendor/vlucas/phpdotenv/phpstan-baseline.neon +0 -157
- package/src/api/core/vendor/vlucas/phpdotenv/phpstan.neon.dist +0 -7
- package/src/api/core/vendor/vlucas/phpdotenv/phpunit.xml.dist +0 -13
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/DotenvTest.php +0 -387
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Loader/LoaderTest.php +0 -86
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Parser/EntryParserTest.php +0 -234
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Parser/LexerTest.php +0 -40
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Parser/LinesTest.php +0 -53
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Parser/ParserTest.php +0 -98
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/Adapter/ArrayAdapterTest.php +0 -57
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/Adapter/EnvConstAdapterTest.php +0 -75
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/Adapter/PutenvAdapterTest.php +0 -52
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/Adapter/ServerConstAdapterTest.php +0 -75
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/RepositoryTest.php +0 -305
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/Store/StoreTest.php +0 -141
- package/src/api/core/vendor/vlucas/phpdotenv/tests/Dotenv/ValidatorTest.php +0 -479
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/.env +0 -5
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/assertions.env +0 -18
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/booleans.env +0 -33
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/commented.env +0 -15
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/empty.env +0 -1
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/example.env +0 -1
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/exported.env +0 -7
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/immutable.env +0 -1
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/integers.env +0 -17
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/large.env +0 -2
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/multibyte.env +0 -3
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/multiline.env +0 -14
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/multiple.env +0 -4
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/mutable.env +0 -1
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/nested.env +0 -15
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/quoted.env +0 -11
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/specialchars.env +0 -8
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/unicodevarnames.env +0 -2
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/utf8-with-bom-encoding.env +0 -3
- package/src/api/core/vendor/vlucas/phpdotenv/tests/fixtures/env/windows.env +0 -1
- package/src/api/core/vendor/vlucas/phpdotenv/vendor-bin/phpstan/composer.json +0 -15
|
@@ -1,299 +1,299 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
declare(strict_types=1);
|
|
4
|
-
|
|
5
|
-
namespace Dotenv\Parser;
|
|
6
|
-
|
|
7
|
-
use Dotenv\Util\Regex;
|
|
8
|
-
use Dotenv\Util\Str;
|
|
9
|
-
use GrahamCampbell\ResultType\Error;
|
|
10
|
-
use GrahamCampbell\ResultType\Result;
|
|
11
|
-
use GrahamCampbell\ResultType\Success;
|
|
12
|
-
|
|
13
|
-
final class EntryParser
|
|
14
|
-
{
|
|
15
|
-
private const INITIAL_STATE = 0;
|
|
16
|
-
private const UNQUOTED_STATE = 1;
|
|
17
|
-
private const SINGLE_QUOTED_STATE = 2;
|
|
18
|
-
private const DOUBLE_QUOTED_STATE = 3;
|
|
19
|
-
private const ESCAPE_SEQUENCE_STATE = 4;
|
|
20
|
-
private const WHITESPACE_STATE = 5;
|
|
21
|
-
private const COMMENT_STATE = 6;
|
|
22
|
-
private const REJECT_STATES = [self::SINGLE_QUOTED_STATE, self::DOUBLE_QUOTED_STATE, self::ESCAPE_SEQUENCE_STATE];
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* This class is a singleton.
|
|
26
|
-
*
|
|
27
|
-
* @codeCoverageIgnore
|
|
28
|
-
*
|
|
29
|
-
* @return void
|
|
30
|
-
*/
|
|
31
|
-
private function __construct()
|
|
32
|
-
{
|
|
33
|
-
//
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Parse a raw entry into a proper entry.
|
|
38
|
-
*
|
|
39
|
-
* That is, turn a raw environment variable entry into a name and possibly
|
|
40
|
-
* a value. We wrap the answer in a result type.
|
|
41
|
-
*
|
|
42
|
-
* @param string $entry
|
|
43
|
-
*
|
|
44
|
-
* @return \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Entry, string>
|
|
45
|
-
*/
|
|
46
|
-
public static function parse(string $entry)
|
|
47
|
-
{
|
|
48
|
-
return self::splitStringIntoParts($entry)->flatMap(static function (array $parts) {
|
|
49
|
-
[$name, $value] = $parts;
|
|
50
|
-
|
|
51
|
-
return self::parseName($name)->flatMap(static function (string $name) use ($value) {
|
|
52
|
-
/** @var Result<Value|null, string> */
|
|
53
|
-
$parsedValue = $value === null ? Success::create(null) : self::parseValue($value);
|
|
54
|
-
|
|
55
|
-
return $parsedValue->map(static function (?Value $value) use ($name) {
|
|
56
|
-
return new Entry($name, $value);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Split the compound string into parts.
|
|
64
|
-
*
|
|
65
|
-
* @param string $line
|
|
66
|
-
*
|
|
67
|
-
* @return \GrahamCampbell\ResultType\Result<array{string, string|null},string>
|
|
68
|
-
*/
|
|
69
|
-
private static function splitStringIntoParts(string $line)
|
|
70
|
-
{
|
|
71
|
-
/** @var array{string, string|null} */
|
|
72
|
-
$result = Str::pos($line, '=')->map(static function () use ($line) {
|
|
73
|
-
return \array_map('trim', \explode('=', $line, 2));
|
|
74
|
-
})->getOrElse([$line, null]);
|
|
75
|
-
|
|
76
|
-
if ($result[0] === '') {
|
|
77
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, string|null},string> */
|
|
78
|
-
return Error::create(self::getErrorMessage('an unexpected equals', $line));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, string|null},string> */
|
|
82
|
-
return Success::create($result);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Parse the given variable name.
|
|
87
|
-
*
|
|
88
|
-
* That is, strip the optional quotes and leading "export" from the
|
|
89
|
-
* variable name. We wrap the answer in a result type.
|
|
90
|
-
*
|
|
91
|
-
* @param string $name
|
|
92
|
-
*
|
|
93
|
-
* @return \GrahamCampbell\ResultType\Result<string, string>
|
|
94
|
-
*/
|
|
95
|
-
private static function parseName(string $name)
|
|
96
|
-
{
|
|
97
|
-
if (Str::len($name) > 8 && Str::substr($name, 0, 6) === 'export' && \ctype_space(Str::substr($name, 6, 1))) {
|
|
98
|
-
$name = \ltrim(Str::substr($name, 6));
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (self::isQuotedName($name)) {
|
|
102
|
-
$name = Str::substr($name, 1, -1);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (!self::isValidName($name)) {
|
|
106
|
-
/** @var \GrahamCampbell\ResultType\Result<string, string> */
|
|
107
|
-
return Error::create(self::getErrorMessage('an invalid name', $name));
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/** @var \GrahamCampbell\ResultType\Result<string, string> */
|
|
111
|
-
return Success::create($name);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Is the given variable name quoted?
|
|
116
|
-
*
|
|
117
|
-
* @param string $name
|
|
118
|
-
*
|
|
119
|
-
* @return bool
|
|
120
|
-
*/
|
|
121
|
-
private static function isQuotedName(string $name)
|
|
122
|
-
{
|
|
123
|
-
if (Str::len($name) < 3) {
|
|
124
|
-
return false;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
$first = Str::substr($name, 0, 1);
|
|
128
|
-
$last = Str::substr($name, -1, 1);
|
|
129
|
-
|
|
130
|
-
return ($first === '"' && $last === '"') || ($first === '\'' && $last === '\'');
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Is the given variable name valid?
|
|
135
|
-
*
|
|
136
|
-
* @param string $name
|
|
137
|
-
*
|
|
138
|
-
* @return bool
|
|
139
|
-
*/
|
|
140
|
-
private static function isValidName(string $name)
|
|
141
|
-
{
|
|
142
|
-
return Regex::matches('~(*UTF8)\A[\p{Ll}\p{Lu}\p{M}\p{N}_.]+\z~', $name)->success()->getOrElse(false);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Parse the given variable value.
|
|
147
|
-
*
|
|
148
|
-
* This has the effect of stripping quotes and comments, dealing with
|
|
149
|
-
* special characters, and locating nested variables, but not resolving
|
|
150
|
-
* them. Formally, we run a finite state automaton with an output tape: a
|
|
151
|
-
* transducer. We wrap the answer in a result type.
|
|
152
|
-
*
|
|
153
|
-
* @param string $value
|
|
154
|
-
*
|
|
155
|
-
* @return \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value, string>
|
|
156
|
-
*/
|
|
157
|
-
private static function parseValue(string $value)
|
|
158
|
-
{
|
|
159
|
-
if (\trim($value) === '') {
|
|
160
|
-
/** @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value, string> */
|
|
161
|
-
return Success::create(Value::blank());
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return \array_reduce(\iterator_to_array(Lexer::lex($value)), static function (Result $data, string $token) {
|
|
165
|
-
return $data->flatMap(static function (array $data) use ($token) {
|
|
166
|
-
return self::processToken($data[1], $token)->map(static function (array $val) use ($data) {
|
|
167
|
-
return [$data[0]->append($val[0], $val[1]), $val[2]];
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
}, Success::create([Value::blank(), self::INITIAL_STATE]))->flatMap(static function (array $result) {
|
|
171
|
-
if (in_array($result[1], self::REJECT_STATES, true)) {
|
|
172
|
-
/** @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value, string> */
|
|
173
|
-
return Error::create('a missing closing quote');
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/** @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value, string> */
|
|
177
|
-
return Success::create($result[0]);
|
|
178
|
-
})->mapError(static function (string $err) use ($value) {
|
|
179
|
-
return self::getErrorMessage($err, $value);
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Process the given token.
|
|
185
|
-
*
|
|
186
|
-
* @param int $state
|
|
187
|
-
* @param string $token
|
|
188
|
-
*
|
|
189
|
-
* @return \GrahamCampbell\ResultType\Result<array{string, bool, int}, string>
|
|
190
|
-
*/
|
|
191
|
-
private static function processToken(int $state, string $token)
|
|
192
|
-
{
|
|
193
|
-
switch ($state) {
|
|
194
|
-
case self::INITIAL_STATE:
|
|
195
|
-
if ($token === '\'') {
|
|
196
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
197
|
-
return Success::create(['', false, self::SINGLE_QUOTED_STATE]);
|
|
198
|
-
} elseif ($token === '"') {
|
|
199
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
200
|
-
return Success::create(['', false, self::DOUBLE_QUOTED_STATE]);
|
|
201
|
-
} elseif ($token === '#') {
|
|
202
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
203
|
-
return Success::create(['', false, self::COMMENT_STATE]);
|
|
204
|
-
} elseif ($token === '$') {
|
|
205
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
206
|
-
return Success::create([$token, true, self::UNQUOTED_STATE]);
|
|
207
|
-
} else {
|
|
208
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
209
|
-
return Success::create([$token, false, self::UNQUOTED_STATE]);
|
|
210
|
-
}
|
|
211
|
-
case self::UNQUOTED_STATE:
|
|
212
|
-
if ($token === '#') {
|
|
213
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
214
|
-
return Success::create(['', false, self::COMMENT_STATE]);
|
|
215
|
-
} elseif (\ctype_space($token)) {
|
|
216
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
217
|
-
return Success::create(['', false, self::WHITESPACE_STATE]);
|
|
218
|
-
} elseif ($token === '$') {
|
|
219
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
220
|
-
return Success::create([$token, true, self::UNQUOTED_STATE]);
|
|
221
|
-
} else {
|
|
222
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
223
|
-
return Success::create([$token, false, self::UNQUOTED_STATE]);
|
|
224
|
-
}
|
|
225
|
-
case self::SINGLE_QUOTED_STATE:
|
|
226
|
-
if ($token === '\'') {
|
|
227
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
228
|
-
return Success::create(['', false, self::WHITESPACE_STATE]);
|
|
229
|
-
} else {
|
|
230
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
231
|
-
return Success::create([$token, false, self::SINGLE_QUOTED_STATE]);
|
|
232
|
-
}
|
|
233
|
-
case self::DOUBLE_QUOTED_STATE:
|
|
234
|
-
if ($token === '"') {
|
|
235
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
236
|
-
return Success::create(['', false, self::WHITESPACE_STATE]);
|
|
237
|
-
} elseif ($token === '\\') {
|
|
238
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
239
|
-
return Success::create(['', false, self::ESCAPE_SEQUENCE_STATE]);
|
|
240
|
-
} elseif ($token === '$') {
|
|
241
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
242
|
-
return Success::create([$token, true, self::DOUBLE_QUOTED_STATE]);
|
|
243
|
-
} else {
|
|
244
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
245
|
-
return Success::create([$token, false, self::DOUBLE_QUOTED_STATE]);
|
|
246
|
-
}
|
|
247
|
-
case self::ESCAPE_SEQUENCE_STATE:
|
|
248
|
-
if ($token === '"' || $token === '\\') {
|
|
249
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
250
|
-
return Success::create([$token, false, self::DOUBLE_QUOTED_STATE]);
|
|
251
|
-
} elseif ($token === '$') {
|
|
252
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
253
|
-
return Success::create([$token, false, self::DOUBLE_QUOTED_STATE]);
|
|
254
|
-
} else {
|
|
255
|
-
$first = Str::substr($token, 0, 1);
|
|
256
|
-
if (\in_array($first, ['f', 'n', 'r', 't', 'v'], true)) {
|
|
257
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
258
|
-
return Success::create([\stripcslashes('\\'.$first).Str::substr($token, 1), false, self::DOUBLE_QUOTED_STATE]);
|
|
259
|
-
} else {
|
|
260
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
261
|
-
return Error::create('an unexpected escape sequence');
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
case self::WHITESPACE_STATE:
|
|
265
|
-
if ($token === '#') {
|
|
266
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
267
|
-
return Success::create(['', false, self::COMMENT_STATE]);
|
|
268
|
-
} elseif (!\ctype_space($token)) {
|
|
269
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
270
|
-
return Error::create('unexpected whitespace');
|
|
271
|
-
} else {
|
|
272
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
273
|
-
return Success::create(['', false, self::WHITESPACE_STATE]);
|
|
274
|
-
}
|
|
275
|
-
case self::COMMENT_STATE:
|
|
276
|
-
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
277
|
-
return Success::create(['', false, self::COMMENT_STATE]);
|
|
278
|
-
default:
|
|
279
|
-
throw new \Error('Parser entered invalid state.');
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Generate a friendly error message.
|
|
285
|
-
*
|
|
286
|
-
* @param string $cause
|
|
287
|
-
* @param string $subject
|
|
288
|
-
*
|
|
289
|
-
* @return string
|
|
290
|
-
*/
|
|
291
|
-
private static function getErrorMessage(string $cause, string $subject)
|
|
292
|
-
{
|
|
293
|
-
return \sprintf(
|
|
294
|
-
'Encountered %s at [%s].',
|
|
295
|
-
$cause,
|
|
296
|
-
\strtok($subject, "\n")
|
|
297
|
-
);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
declare(strict_types=1);
|
|
4
|
+
|
|
5
|
+
namespace Dotenv\Parser;
|
|
6
|
+
|
|
7
|
+
use Dotenv\Util\Regex;
|
|
8
|
+
use Dotenv\Util\Str;
|
|
9
|
+
use GrahamCampbell\ResultType\Error;
|
|
10
|
+
use GrahamCampbell\ResultType\Result;
|
|
11
|
+
use GrahamCampbell\ResultType\Success;
|
|
12
|
+
|
|
13
|
+
final class EntryParser
|
|
14
|
+
{
|
|
15
|
+
private const INITIAL_STATE = 0;
|
|
16
|
+
private const UNQUOTED_STATE = 1;
|
|
17
|
+
private const SINGLE_QUOTED_STATE = 2;
|
|
18
|
+
private const DOUBLE_QUOTED_STATE = 3;
|
|
19
|
+
private const ESCAPE_SEQUENCE_STATE = 4;
|
|
20
|
+
private const WHITESPACE_STATE = 5;
|
|
21
|
+
private const COMMENT_STATE = 6;
|
|
22
|
+
private const REJECT_STATES = [self::SINGLE_QUOTED_STATE, self::DOUBLE_QUOTED_STATE, self::ESCAPE_SEQUENCE_STATE];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* This class is a singleton.
|
|
26
|
+
*
|
|
27
|
+
* @codeCoverageIgnore
|
|
28
|
+
*
|
|
29
|
+
* @return void
|
|
30
|
+
*/
|
|
31
|
+
private function __construct()
|
|
32
|
+
{
|
|
33
|
+
//
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Parse a raw entry into a proper entry.
|
|
38
|
+
*
|
|
39
|
+
* That is, turn a raw environment variable entry into a name and possibly
|
|
40
|
+
* a value. We wrap the answer in a result type.
|
|
41
|
+
*
|
|
42
|
+
* @param string $entry
|
|
43
|
+
*
|
|
44
|
+
* @return \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Entry, string>
|
|
45
|
+
*/
|
|
46
|
+
public static function parse(string $entry)
|
|
47
|
+
{
|
|
48
|
+
return self::splitStringIntoParts($entry)->flatMap(static function (array $parts) {
|
|
49
|
+
[$name, $value] = $parts;
|
|
50
|
+
|
|
51
|
+
return self::parseName($name)->flatMap(static function (string $name) use ($value) {
|
|
52
|
+
/** @var Result<Value|null, string> */
|
|
53
|
+
$parsedValue = $value === null ? Success::create(null) : self::parseValue($value);
|
|
54
|
+
|
|
55
|
+
return $parsedValue->map(static function (?Value $value) use ($name) {
|
|
56
|
+
return new Entry($name, $value);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Split the compound string into parts.
|
|
64
|
+
*
|
|
65
|
+
* @param string $line
|
|
66
|
+
*
|
|
67
|
+
* @return \GrahamCampbell\ResultType\Result<array{string, string|null},string>
|
|
68
|
+
*/
|
|
69
|
+
private static function splitStringIntoParts(string $line)
|
|
70
|
+
{
|
|
71
|
+
/** @var array{string, string|null} */
|
|
72
|
+
$result = Str::pos($line, '=')->map(static function () use ($line) {
|
|
73
|
+
return \array_map('trim', \explode('=', $line, 2));
|
|
74
|
+
})->getOrElse([$line, null]);
|
|
75
|
+
|
|
76
|
+
if ($result[0] === '') {
|
|
77
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, string|null},string> */
|
|
78
|
+
return Error::create(self::getErrorMessage('an unexpected equals', $line));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, string|null},string> */
|
|
82
|
+
return Success::create($result);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Parse the given variable name.
|
|
87
|
+
*
|
|
88
|
+
* That is, strip the optional quotes and leading "export" from the
|
|
89
|
+
* variable name. We wrap the answer in a result type.
|
|
90
|
+
*
|
|
91
|
+
* @param string $name
|
|
92
|
+
*
|
|
93
|
+
* @return \GrahamCampbell\ResultType\Result<string, string>
|
|
94
|
+
*/
|
|
95
|
+
private static function parseName(string $name)
|
|
96
|
+
{
|
|
97
|
+
if (Str::len($name) > 8 && Str::substr($name, 0, 6) === 'export' && \ctype_space(Str::substr($name, 6, 1))) {
|
|
98
|
+
$name = \ltrim(Str::substr($name, 6));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (self::isQuotedName($name)) {
|
|
102
|
+
$name = Str::substr($name, 1, -1);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (!self::isValidName($name)) {
|
|
106
|
+
/** @var \GrahamCampbell\ResultType\Result<string, string> */
|
|
107
|
+
return Error::create(self::getErrorMessage('an invalid name', $name));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** @var \GrahamCampbell\ResultType\Result<string, string> */
|
|
111
|
+
return Success::create($name);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Is the given variable name quoted?
|
|
116
|
+
*
|
|
117
|
+
* @param string $name
|
|
118
|
+
*
|
|
119
|
+
* @return bool
|
|
120
|
+
*/
|
|
121
|
+
private static function isQuotedName(string $name)
|
|
122
|
+
{
|
|
123
|
+
if (Str::len($name) < 3) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
$first = Str::substr($name, 0, 1);
|
|
128
|
+
$last = Str::substr($name, -1, 1);
|
|
129
|
+
|
|
130
|
+
return ($first === '"' && $last === '"') || ($first === '\'' && $last === '\'');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Is the given variable name valid?
|
|
135
|
+
*
|
|
136
|
+
* @param string $name
|
|
137
|
+
*
|
|
138
|
+
* @return bool
|
|
139
|
+
*/
|
|
140
|
+
private static function isValidName(string $name)
|
|
141
|
+
{
|
|
142
|
+
return Regex::matches('~(*UTF8)\A[\p{Ll}\p{Lu}\p{M}\p{N}_.]+\z~', $name)->success()->getOrElse(false);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Parse the given variable value.
|
|
147
|
+
*
|
|
148
|
+
* This has the effect of stripping quotes and comments, dealing with
|
|
149
|
+
* special characters, and locating nested variables, but not resolving
|
|
150
|
+
* them. Formally, we run a finite state automaton with an output tape: a
|
|
151
|
+
* transducer. We wrap the answer in a result type.
|
|
152
|
+
*
|
|
153
|
+
* @param string $value
|
|
154
|
+
*
|
|
155
|
+
* @return \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value, string>
|
|
156
|
+
*/
|
|
157
|
+
private static function parseValue(string $value)
|
|
158
|
+
{
|
|
159
|
+
if (\trim($value) === '') {
|
|
160
|
+
/** @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value, string> */
|
|
161
|
+
return Success::create(Value::blank());
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return \array_reduce(\iterator_to_array(Lexer::lex($value)), static function (Result $data, string $token) {
|
|
165
|
+
return $data->flatMap(static function (array $data) use ($token) {
|
|
166
|
+
return self::processToken($data[1], $token)->map(static function (array $val) use ($data) {
|
|
167
|
+
return [$data[0]->append($val[0], $val[1]), $val[2]];
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
}, Success::create([Value::blank(), self::INITIAL_STATE]))->flatMap(static function (array $result) {
|
|
171
|
+
if (in_array($result[1], self::REJECT_STATES, true)) {
|
|
172
|
+
/** @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value, string> */
|
|
173
|
+
return Error::create('a missing closing quote');
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Value, string> */
|
|
177
|
+
return Success::create($result[0]);
|
|
178
|
+
})->mapError(static function (string $err) use ($value) {
|
|
179
|
+
return self::getErrorMessage($err, $value);
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Process the given token.
|
|
185
|
+
*
|
|
186
|
+
* @param int $state
|
|
187
|
+
* @param string $token
|
|
188
|
+
*
|
|
189
|
+
* @return \GrahamCampbell\ResultType\Result<array{string, bool, int}, string>
|
|
190
|
+
*/
|
|
191
|
+
private static function processToken(int $state, string $token)
|
|
192
|
+
{
|
|
193
|
+
switch ($state) {
|
|
194
|
+
case self::INITIAL_STATE:
|
|
195
|
+
if ($token === '\'') {
|
|
196
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
197
|
+
return Success::create(['', false, self::SINGLE_QUOTED_STATE]);
|
|
198
|
+
} elseif ($token === '"') {
|
|
199
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
200
|
+
return Success::create(['', false, self::DOUBLE_QUOTED_STATE]);
|
|
201
|
+
} elseif ($token === '#') {
|
|
202
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
203
|
+
return Success::create(['', false, self::COMMENT_STATE]);
|
|
204
|
+
} elseif ($token === '$') {
|
|
205
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
206
|
+
return Success::create([$token, true, self::UNQUOTED_STATE]);
|
|
207
|
+
} else {
|
|
208
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
209
|
+
return Success::create([$token, false, self::UNQUOTED_STATE]);
|
|
210
|
+
}
|
|
211
|
+
case self::UNQUOTED_STATE:
|
|
212
|
+
if ($token === '#') {
|
|
213
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
214
|
+
return Success::create(['', false, self::COMMENT_STATE]);
|
|
215
|
+
} elseif (\ctype_space($token)) {
|
|
216
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
217
|
+
return Success::create(['', false, self::WHITESPACE_STATE]);
|
|
218
|
+
} elseif ($token === '$') {
|
|
219
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
220
|
+
return Success::create([$token, true, self::UNQUOTED_STATE]);
|
|
221
|
+
} else {
|
|
222
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
223
|
+
return Success::create([$token, false, self::UNQUOTED_STATE]);
|
|
224
|
+
}
|
|
225
|
+
case self::SINGLE_QUOTED_STATE:
|
|
226
|
+
if ($token === '\'') {
|
|
227
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
228
|
+
return Success::create(['', false, self::WHITESPACE_STATE]);
|
|
229
|
+
} else {
|
|
230
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
231
|
+
return Success::create([$token, false, self::SINGLE_QUOTED_STATE]);
|
|
232
|
+
}
|
|
233
|
+
case self::DOUBLE_QUOTED_STATE:
|
|
234
|
+
if ($token === '"') {
|
|
235
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
236
|
+
return Success::create(['', false, self::WHITESPACE_STATE]);
|
|
237
|
+
} elseif ($token === '\\') {
|
|
238
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
239
|
+
return Success::create(['', false, self::ESCAPE_SEQUENCE_STATE]);
|
|
240
|
+
} elseif ($token === '$') {
|
|
241
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
242
|
+
return Success::create([$token, true, self::DOUBLE_QUOTED_STATE]);
|
|
243
|
+
} else {
|
|
244
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
245
|
+
return Success::create([$token, false, self::DOUBLE_QUOTED_STATE]);
|
|
246
|
+
}
|
|
247
|
+
case self::ESCAPE_SEQUENCE_STATE:
|
|
248
|
+
if ($token === '"' || $token === '\\') {
|
|
249
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
250
|
+
return Success::create([$token, false, self::DOUBLE_QUOTED_STATE]);
|
|
251
|
+
} elseif ($token === '$') {
|
|
252
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
253
|
+
return Success::create([$token, false, self::DOUBLE_QUOTED_STATE]);
|
|
254
|
+
} else {
|
|
255
|
+
$first = Str::substr($token, 0, 1);
|
|
256
|
+
if (\in_array($first, ['f', 'n', 'r', 't', 'v'], true)) {
|
|
257
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
258
|
+
return Success::create([\stripcslashes('\\'.$first).Str::substr($token, 1), false, self::DOUBLE_QUOTED_STATE]);
|
|
259
|
+
} else {
|
|
260
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
261
|
+
return Error::create('an unexpected escape sequence');
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
case self::WHITESPACE_STATE:
|
|
265
|
+
if ($token === '#') {
|
|
266
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
267
|
+
return Success::create(['', false, self::COMMENT_STATE]);
|
|
268
|
+
} elseif (!\ctype_space($token)) {
|
|
269
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
270
|
+
return Error::create('unexpected whitespace');
|
|
271
|
+
} else {
|
|
272
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
273
|
+
return Success::create(['', false, self::WHITESPACE_STATE]);
|
|
274
|
+
}
|
|
275
|
+
case self::COMMENT_STATE:
|
|
276
|
+
/** @var \GrahamCampbell\ResultType\Result<array{string, bool, int}, string> */
|
|
277
|
+
return Success::create(['', false, self::COMMENT_STATE]);
|
|
278
|
+
default:
|
|
279
|
+
throw new \Error('Parser entered invalid state.');
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Generate a friendly error message.
|
|
285
|
+
*
|
|
286
|
+
* @param string $cause
|
|
287
|
+
* @param string $subject
|
|
288
|
+
*
|
|
289
|
+
* @return string
|
|
290
|
+
*/
|
|
291
|
+
private static function getErrorMessage(string $cause, string $subject)
|
|
292
|
+
{
|
|
293
|
+
return \sprintf(
|
|
294
|
+
'Encountered %s at [%s].',
|
|
295
|
+
$cause,
|
|
296
|
+
\strtok($subject, "\n")
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
}
|