create-berna-stencil 2.0.7 → 2.0.9
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 +38 -19
- package/README.md +2 -1
- package/bin/create.js +2 -2
- package/docs/Components.md +12 -0
- package/docs/Creating pages.md +3 -4
- package/docs/Head and SEO.md +7 -7
- package/package.json +63 -61
- package/src/backend/_core/vendor/composer/autoload_static.php +10 -10
- package/src/backend/_core/vendor/composer/installed.json +6 -6
- package/src/backend/_core/vendor/composer/installed.php +2 -2
- package/src/backend/_core/vendor/graham-campbell/result-type/LICENSE +21 -21
- package/src/backend/_core/vendor/graham-campbell/result-type/composer.json +33 -33
- package/src/backend/_core/vendor/graham-campbell/result-type/src/Error.php +121 -121
- package/src/backend/_core/vendor/graham-campbell/result-type/src/Result.php +69 -69
- package/src/backend/_core/vendor/graham-campbell/result-type/src/Success.php +120 -120
- package/src/backend/_core/vendor/phpoption/phpoption/LICENSE +200 -200
- package/src/backend/_core/vendor/phpoption/phpoption/composer.json +50 -50
- package/src/backend/_core/vendor/phpoption/phpoption/src/PhpOption/LazyOption.php +175 -175
- package/src/backend/_core/vendor/phpoption/phpoption/src/PhpOption/None.php +136 -136
- package/src/backend/_core/vendor/phpoption/phpoption/src/PhpOption/Option.php +434 -434
- package/src/backend/_core/vendor/phpoption/phpoption/src/PhpOption/Some.php +169 -169
- package/src/backend/_core/vendor/symfony/polyfill-ctype/Ctype.php +232 -232
- package/src/backend/_core/vendor/symfony/polyfill-ctype/LICENSE +19 -19
- package/src/backend/_core/vendor/symfony/polyfill-ctype/README.md +12 -12
- package/src/backend/_core/vendor/symfony/polyfill-ctype/bootstrap.php +50 -50
- package/src/backend/_core/vendor/symfony/polyfill-ctype/bootstrap80.php +46 -46
- package/src/backend/_core/vendor/symfony/polyfill-ctype/composer.json +38 -38
- package/src/backend/_core/vendor/symfony/polyfill-mbstring/LICENSE +19 -19
- package/src/backend/_core/vendor/symfony/polyfill-mbstring/Mbstring.php +1077 -1077
- package/src/backend/_core/vendor/symfony/polyfill-mbstring/README.md +13 -13
- package/src/backend/_core/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php +119 -119
- package/src/backend/_core/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php +1397 -1397
- package/src/backend/_core/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php +5 -5
- package/src/backend/_core/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php +1489 -1489
- package/src/backend/_core/vendor/symfony/polyfill-mbstring/bootstrap.php +171 -171
- package/src/backend/_core/vendor/symfony/polyfill-mbstring/bootstrap80.php +167 -167
- package/src/backend/_core/vendor/symfony/polyfill-mbstring/composer.json +39 -39
- package/src/backend/_core/vendor/symfony/polyfill-php80/LICENSE +19 -19
- package/src/backend/_core/vendor/symfony/polyfill-php80/Php80.php +115 -115
- package/src/backend/_core/vendor/symfony/polyfill-php80/PhpToken.php +106 -106
- package/src/backend/_core/vendor/symfony/polyfill-php80/README.md +25 -25
- package/src/backend/_core/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php +31 -31
- package/src/backend/_core/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php +16 -16
- package/src/backend/_core/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php +20 -20
- package/src/backend/_core/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php +16 -16
- package/src/backend/_core/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php +16 -16
- package/src/backend/_core/vendor/symfony/polyfill-php80/bootstrap.php +42 -42
- package/src/backend/_core/vendor/symfony/polyfill-php80/composer.json +37 -37
- package/src/backend/_core/vendor/vlucas/phpdotenv/LICENSE +30 -30
- package/src/backend/_core/vendor/vlucas/phpdotenv/composer.json +60 -60
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Dotenv.php +267 -267
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Exception/ExceptionInterface.php +12 -12
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Exception/InvalidEncodingException.php +12 -12
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Exception/InvalidFileException.php +12 -12
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Exception/InvalidPathException.php +12 -12
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Exception/ValidationException.php +12 -12
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Loader/Loader.php +48 -48
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Loader/LoaderInterface.php +20 -20
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Loader/Resolver.php +65 -65
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Parser/Entry.php +59 -59
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Parser/EntryParser.php +299 -299
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Parser/Lexer.php +58 -58
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Parser/Lines.php +127 -127
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Parser/Parser.php +53 -53
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Parser/ParserInterface.php +19 -19
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Parser/Value.php +88 -88
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Repository/Adapter/AdapterInterface.php +15 -15
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ApacheAdapter.php +89 -89
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ArrayAdapter.php +80 -80
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Repository/Adapter/EnvConstAdapter.php +88 -88
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Repository/Adapter/GuardedWriter.php +85 -85
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ImmutableWriter.php +110 -110
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Repository/Adapter/MultiReader.php +48 -48
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Repository/Adapter/MultiWriter.php +64 -64
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Repository/Adapter/PutenvAdapter.php +91 -91
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ReaderInterface.php +17 -17
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ReplacingWriter.php +104 -104
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Repository/Adapter/ServerConstAdapter.php +88 -88
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Repository/Adapter/WriterInterface.php +27 -27
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Repository/AdapterRepository.php +107 -107
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Repository/RepositoryBuilder.php +272 -272
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Repository/RepositoryInterface.php +51 -51
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Store/File/Paths.php +44 -44
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Store/File/Reader.php +81 -81
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Store/FileStore.php +72 -72
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Store/StoreBuilder.php +141 -141
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Store/StoreInterface.php +17 -17
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Store/StringStore.php +37 -37
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Util/Regex.php +112 -112
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Util/Str.php +108 -108
- package/src/backend/_core/vendor/vlucas/phpdotenv/src/Validator.php +207 -207
- package/src/frontend/404.njk +2 -1
- package/src/frontend/components/global/footer.njk +13 -12
- package/src/frontend/components/global/header.njk +0 -4
- package/src/frontend/components/layouts/base.njk +47 -34
- package/src/frontend/components/welcome.njk +32 -668
- package/src/frontend/data/site.json +43 -43
- package/src/frontend/scss/modules/_buttons.scss +10 -4
- package/src/frontend/scss/modules/_footer.scss +5 -14
- package/src/frontend/scss/modules/_global.scss +1 -2
- package/src/frontend/scss/pages/404.scss +1 -1
- package/src/backend/_core/vendor/graham-campbell/result-type/.gitattributes +0 -9
- package/src/backend/_core/vendor/graham-campbell/result-type/.github/CODE_OF_CONDUCT.md +0 -132
- package/src/backend/_core/vendor/graham-campbell/result-type/.github/CONTRIBUTING.md +0 -31
- package/src/backend/_core/vendor/graham-campbell/result-type/.github/FUNDING.yml +0 -2
- package/src/backend/_core/vendor/graham-campbell/result-type/.github/SECURITY.md +0 -14
- package/src/backend/_core/vendor/graham-campbell/result-type/.github/workflows/stale.yml +0 -11
- package/src/backend/_core/vendor/graham-campbell/result-type/.github/workflows/tests.yml +0 -40
- package/src/backend/_core/vendor/graham-campbell/result-type/CHANGELOG.md +0 -53
- package/src/backend/_core/vendor/graham-campbell/result-type/README.md +0 -42
- package/src/backend/_core/vendor/graham-campbell/result-type/phpunit.xml.dist +0 -13
- package/src/backend/_core/vendor/graham-campbell/result-type/tests/ResultTest.php +0 -95
- package/src/backend/_core/vendor/phpoption/phpoption/.gitattributes +0 -13
- package/src/backend/_core/vendor/phpoption/phpoption/.github/CODE_OF_CONDUCT.md +0 -132
- package/src/backend/_core/vendor/phpoption/phpoption/.github/CONTRIBUTING.md +0 -30
- package/src/backend/_core/vendor/phpoption/phpoption/.github/FUNDING.yml +0 -2
- package/src/backend/_core/vendor/phpoption/phpoption/.github/SECURITY.md +0 -14
- package/src/backend/_core/vendor/phpoption/phpoption/.github/workflows/static.yml +0 -40
- package/src/backend/_core/vendor/phpoption/phpoption/.github/workflows/tests.yml +0 -40
- package/src/backend/_core/vendor/phpoption/phpoption/Makefile +0 -17
- package/src/backend/_core/vendor/phpoption/phpoption/README.md +0 -201
- package/src/backend/_core/vendor/phpoption/phpoption/phpstan-baseline.neon +0 -44
- package/src/backend/_core/vendor/phpoption/phpoption/phpstan.neon.dist +0 -7
- package/src/backend/_core/vendor/phpoption/phpoption/phpunit.xml.dist +0 -13
- package/src/backend/_core/vendor/phpoption/phpoption/tests/PhpOption/Tests/EnsureTest.php +0 -72
- package/src/backend/_core/vendor/phpoption/phpoption/tests/PhpOption/Tests/LazyOptionTest.php +0 -357
- package/src/backend/_core/vendor/phpoption/phpoption/tests/PhpOption/Tests/NoneTest.php +0 -153
- package/src/backend/_core/vendor/phpoption/phpoption/tests/PhpOption/Tests/OptionTest.php +0 -166
- package/src/backend/_core/vendor/phpoption/phpoption/tests/PhpOption/Tests/SomeTest.php +0 -194
- package/src/backend/_core/vendor/phpoption/phpoption/tests/bootstrap.php +0 -8
- package/src/backend/_core/vendor/phpoption/phpoption/vendor-bin/phpstan/composer.json +0 -8
- package/src/backend/_core/vendor/vlucas/phpdotenv/.editorconfig +0 -15
- package/src/backend/_core/vendor/vlucas/phpdotenv/.gitattributes +0 -15
- package/src/backend/_core/vendor/vlucas/phpdotenv/.github/CODE_OF_CONDUCT.md +0 -132
- package/src/backend/_core/vendor/vlucas/phpdotenv/.github/CONTRIBUTING.md +0 -30
- package/src/backend/_core/vendor/vlucas/phpdotenv/.github/FUNDING.yml +0 -2
- package/src/backend/_core/vendor/vlucas/phpdotenv/.github/SECURITY.md +0 -14
- package/src/backend/_core/vendor/vlucas/phpdotenv/.github/workflows/static.yml +0 -40
- package/src/backend/_core/vendor/vlucas/phpdotenv/.github/workflows/tests.yml +0 -70
- package/src/backend/_core/vendor/vlucas/phpdotenv/Makefile +0 -17
- package/src/backend/_core/vendor/vlucas/phpdotenv/README.md +0 -370
- package/src/backend/_core/vendor/vlucas/phpdotenv/UPGRADING.md +0 -196
- package/src/backend/_core/vendor/vlucas/phpdotenv/phpstan-baseline.neon +0 -157
- package/src/backend/_core/vendor/vlucas/phpdotenv/phpstan.neon.dist +0 -7
- package/src/backend/_core/vendor/vlucas/phpdotenv/phpunit.xml.dist +0 -13
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/Dotenv/DotenvTest.php +0 -387
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/Dotenv/Loader/LoaderTest.php +0 -86
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/Dotenv/Parser/EntryParserTest.php +0 -234
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/Dotenv/Parser/LexerTest.php +0 -40
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/Dotenv/Parser/LinesTest.php +0 -53
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/Dotenv/Parser/ParserTest.php +0 -98
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/Adapter/ArrayAdapterTest.php +0 -57
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/Adapter/EnvConstAdapterTest.php +0 -75
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/Adapter/PutenvAdapterTest.php +0 -52
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/Adapter/ServerConstAdapterTest.php +0 -75
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/Dotenv/Repository/RepositoryTest.php +0 -305
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/Dotenv/Store/StoreTest.php +0 -141
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/Dotenv/ValidatorTest.php +0 -479
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/.env +0 -5
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/assertions.env +0 -18
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/booleans.env +0 -33
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/commented.env +0 -15
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/empty.env +0 -1
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/example.env +0 -1
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/exported.env +0 -7
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/immutable.env +0 -1
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/integers.env +0 -17
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/large.env +0 -2
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/multibyte.env +0 -3
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/multiline.env +0 -14
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/multiple.env +0 -4
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/mutable.env +0 -1
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/nested.env +0 -15
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/quoted.env +0 -11
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/specialchars.env +0 -8
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/unicodevarnames.env +0 -2
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/utf8-with-bom-encoding.env +0 -3
- package/src/backend/_core/vendor/vlucas/phpdotenv/tests/fixtures/env/windows.env +0 -1
- package/src/backend/_core/vendor/vlucas/phpdotenv/vendor-bin/phpstan/composer.json +0 -15
- package/src/backend/config.php +0 -19
|
@@ -1,207 +1,207 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
declare(strict_types=1);
|
|
4
|
-
|
|
5
|
-
namespace Dotenv;
|
|
6
|
-
|
|
7
|
-
use Dotenv\Exception\ValidationException;
|
|
8
|
-
use Dotenv\Repository\RepositoryInterface;
|
|
9
|
-
use Dotenv\Util\Regex;
|
|
10
|
-
use Dotenv\Util\Str;
|
|
11
|
-
|
|
12
|
-
class Validator
|
|
13
|
-
{
|
|
14
|
-
/**
|
|
15
|
-
* The environment repository instance.
|
|
16
|
-
*
|
|
17
|
-
* @var \Dotenv\Repository\RepositoryInterface
|
|
18
|
-
*/
|
|
19
|
-
private $repository;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* The variables to validate.
|
|
23
|
-
*
|
|
24
|
-
* @var string[]
|
|
25
|
-
*/
|
|
26
|
-
private $variables;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Create a new validator instance.
|
|
30
|
-
*
|
|
31
|
-
* @param \Dotenv\Repository\RepositoryInterface $repository
|
|
32
|
-
* @param string[] $variables
|
|
33
|
-
*
|
|
34
|
-
* @return void
|
|
35
|
-
*/
|
|
36
|
-
public function __construct(RepositoryInterface $repository, array $variables)
|
|
37
|
-
{
|
|
38
|
-
$this->repository = $repository;
|
|
39
|
-
$this->variables = $variables;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Assert that each variable is present.
|
|
44
|
-
*
|
|
45
|
-
* @throws \Dotenv\Exception\ValidationException
|
|
46
|
-
*
|
|
47
|
-
* @return \Dotenv\Validator
|
|
48
|
-
*/
|
|
49
|
-
public function required()
|
|
50
|
-
{
|
|
51
|
-
return $this->assert(
|
|
52
|
-
static function (?string $value) {
|
|
53
|
-
return $value !== null;
|
|
54
|
-
},
|
|
55
|
-
'is missing'
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Assert that each variable is not empty.
|
|
61
|
-
*
|
|
62
|
-
* @throws \Dotenv\Exception\ValidationException
|
|
63
|
-
*
|
|
64
|
-
* @return \Dotenv\Validator
|
|
65
|
-
*/
|
|
66
|
-
public function notEmpty()
|
|
67
|
-
{
|
|
68
|
-
return $this->assertNullable(
|
|
69
|
-
static function (string $value) {
|
|
70
|
-
return Str::len(\trim($value)) > 0;
|
|
71
|
-
},
|
|
72
|
-
'is empty'
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Assert that each specified variable is an integer.
|
|
78
|
-
*
|
|
79
|
-
* @throws \Dotenv\Exception\ValidationException
|
|
80
|
-
*
|
|
81
|
-
* @return \Dotenv\Validator
|
|
82
|
-
*/
|
|
83
|
-
public function isInteger()
|
|
84
|
-
{
|
|
85
|
-
return $this->assertNullable(
|
|
86
|
-
static function (string $value) {
|
|
87
|
-
return \ctype_digit($value);
|
|
88
|
-
},
|
|
89
|
-
'is not an integer'
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Assert that each specified variable is a boolean.
|
|
95
|
-
*
|
|
96
|
-
* @throws \Dotenv\Exception\ValidationException
|
|
97
|
-
*
|
|
98
|
-
* @return \Dotenv\Validator
|
|
99
|
-
*/
|
|
100
|
-
public function isBoolean()
|
|
101
|
-
{
|
|
102
|
-
return $this->assertNullable(
|
|
103
|
-
static function (string $value) {
|
|
104
|
-
if ($value === '') {
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return \filter_var($value, \FILTER_VALIDATE_BOOLEAN, \FILTER_NULL_ON_FAILURE) !== null;
|
|
109
|
-
},
|
|
110
|
-
'is not a boolean'
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Assert that each variable is amongst the given choices.
|
|
116
|
-
*
|
|
117
|
-
* @param string[] $choices
|
|
118
|
-
*
|
|
119
|
-
* @throws \Dotenv\Exception\ValidationException
|
|
120
|
-
*
|
|
121
|
-
* @return \Dotenv\Validator
|
|
122
|
-
*/
|
|
123
|
-
public function allowedValues(array $choices)
|
|
124
|
-
{
|
|
125
|
-
return $this->assertNullable(
|
|
126
|
-
static function (string $value) use ($choices) {
|
|
127
|
-
return \in_array($value, $choices, true);
|
|
128
|
-
},
|
|
129
|
-
\sprintf('is not one of [%s]', \implode(', ', $choices))
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Assert that each variable matches the given regular expression.
|
|
135
|
-
*
|
|
136
|
-
* @param string $regex
|
|
137
|
-
*
|
|
138
|
-
* @throws \Dotenv\Exception\ValidationException
|
|
139
|
-
*
|
|
140
|
-
* @return \Dotenv\Validator
|
|
141
|
-
*/
|
|
142
|
-
public function allowedRegexValues(string $regex)
|
|
143
|
-
{
|
|
144
|
-
return $this->assertNullable(
|
|
145
|
-
static function (string $value) use ($regex) {
|
|
146
|
-
return Regex::matches($regex, $value)->success()->getOrElse(false);
|
|
147
|
-
},
|
|
148
|
-
\sprintf('does not match "%s"', $regex)
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Assert that the callback returns true for each variable.
|
|
154
|
-
*
|
|
155
|
-
* @param callable(?string):bool $callback
|
|
156
|
-
* @param string $message
|
|
157
|
-
*
|
|
158
|
-
* @throws \Dotenv\Exception\ValidationException
|
|
159
|
-
*
|
|
160
|
-
* @return \Dotenv\Validator
|
|
161
|
-
*/
|
|
162
|
-
public function assert(callable $callback, string $message)
|
|
163
|
-
{
|
|
164
|
-
$failing = [];
|
|
165
|
-
|
|
166
|
-
foreach ($this->variables as $variable) {
|
|
167
|
-
if ($callback($this->repository->get($variable)) === false) {
|
|
168
|
-
$failing[] = \sprintf('%s %s', $variable, $message);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (\count($failing) > 0) {
|
|
173
|
-
throw new ValidationException(\sprintf(
|
|
174
|
-
'One or more environment variables failed assertions: %s.',
|
|
175
|
-
\implode(', ', $failing)
|
|
176
|
-
));
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return $this;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Assert that the callback returns true for each variable.
|
|
184
|
-
*
|
|
185
|
-
* Skip checking null variable values.
|
|
186
|
-
*
|
|
187
|
-
* @param callable(string):bool $callback
|
|
188
|
-
* @param string $message
|
|
189
|
-
*
|
|
190
|
-
* @throws \Dotenv\Exception\ValidationException
|
|
191
|
-
*
|
|
192
|
-
* @return \Dotenv\Validator
|
|
193
|
-
*/
|
|
194
|
-
public function assertNullable(callable $callback, string $message)
|
|
195
|
-
{
|
|
196
|
-
return $this->assert(
|
|
197
|
-
static function (?string $value) use ($callback) {
|
|
198
|
-
if ($value === null) {
|
|
199
|
-
return true;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return $callback($value);
|
|
203
|
-
},
|
|
204
|
-
$message
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
declare(strict_types=1);
|
|
4
|
+
|
|
5
|
+
namespace Dotenv;
|
|
6
|
+
|
|
7
|
+
use Dotenv\Exception\ValidationException;
|
|
8
|
+
use Dotenv\Repository\RepositoryInterface;
|
|
9
|
+
use Dotenv\Util\Regex;
|
|
10
|
+
use Dotenv\Util\Str;
|
|
11
|
+
|
|
12
|
+
class Validator
|
|
13
|
+
{
|
|
14
|
+
/**
|
|
15
|
+
* The environment repository instance.
|
|
16
|
+
*
|
|
17
|
+
* @var \Dotenv\Repository\RepositoryInterface
|
|
18
|
+
*/
|
|
19
|
+
private $repository;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The variables to validate.
|
|
23
|
+
*
|
|
24
|
+
* @var string[]
|
|
25
|
+
*/
|
|
26
|
+
private $variables;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Create a new validator instance.
|
|
30
|
+
*
|
|
31
|
+
* @param \Dotenv\Repository\RepositoryInterface $repository
|
|
32
|
+
* @param string[] $variables
|
|
33
|
+
*
|
|
34
|
+
* @return void
|
|
35
|
+
*/
|
|
36
|
+
public function __construct(RepositoryInterface $repository, array $variables)
|
|
37
|
+
{
|
|
38
|
+
$this->repository = $repository;
|
|
39
|
+
$this->variables = $variables;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Assert that each variable is present.
|
|
44
|
+
*
|
|
45
|
+
* @throws \Dotenv\Exception\ValidationException
|
|
46
|
+
*
|
|
47
|
+
* @return \Dotenv\Validator
|
|
48
|
+
*/
|
|
49
|
+
public function required()
|
|
50
|
+
{
|
|
51
|
+
return $this->assert(
|
|
52
|
+
static function (?string $value) {
|
|
53
|
+
return $value !== null;
|
|
54
|
+
},
|
|
55
|
+
'is missing'
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Assert that each variable is not empty.
|
|
61
|
+
*
|
|
62
|
+
* @throws \Dotenv\Exception\ValidationException
|
|
63
|
+
*
|
|
64
|
+
* @return \Dotenv\Validator
|
|
65
|
+
*/
|
|
66
|
+
public function notEmpty()
|
|
67
|
+
{
|
|
68
|
+
return $this->assertNullable(
|
|
69
|
+
static function (string $value) {
|
|
70
|
+
return Str::len(\trim($value)) > 0;
|
|
71
|
+
},
|
|
72
|
+
'is empty'
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Assert that each specified variable is an integer.
|
|
78
|
+
*
|
|
79
|
+
* @throws \Dotenv\Exception\ValidationException
|
|
80
|
+
*
|
|
81
|
+
* @return \Dotenv\Validator
|
|
82
|
+
*/
|
|
83
|
+
public function isInteger()
|
|
84
|
+
{
|
|
85
|
+
return $this->assertNullable(
|
|
86
|
+
static function (string $value) {
|
|
87
|
+
return \ctype_digit($value);
|
|
88
|
+
},
|
|
89
|
+
'is not an integer'
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Assert that each specified variable is a boolean.
|
|
95
|
+
*
|
|
96
|
+
* @throws \Dotenv\Exception\ValidationException
|
|
97
|
+
*
|
|
98
|
+
* @return \Dotenv\Validator
|
|
99
|
+
*/
|
|
100
|
+
public function isBoolean()
|
|
101
|
+
{
|
|
102
|
+
return $this->assertNullable(
|
|
103
|
+
static function (string $value) {
|
|
104
|
+
if ($value === '') {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return \filter_var($value, \FILTER_VALIDATE_BOOLEAN, \FILTER_NULL_ON_FAILURE) !== null;
|
|
109
|
+
},
|
|
110
|
+
'is not a boolean'
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Assert that each variable is amongst the given choices.
|
|
116
|
+
*
|
|
117
|
+
* @param string[] $choices
|
|
118
|
+
*
|
|
119
|
+
* @throws \Dotenv\Exception\ValidationException
|
|
120
|
+
*
|
|
121
|
+
* @return \Dotenv\Validator
|
|
122
|
+
*/
|
|
123
|
+
public function allowedValues(array $choices)
|
|
124
|
+
{
|
|
125
|
+
return $this->assertNullable(
|
|
126
|
+
static function (string $value) use ($choices) {
|
|
127
|
+
return \in_array($value, $choices, true);
|
|
128
|
+
},
|
|
129
|
+
\sprintf('is not one of [%s]', \implode(', ', $choices))
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Assert that each variable matches the given regular expression.
|
|
135
|
+
*
|
|
136
|
+
* @param string $regex
|
|
137
|
+
*
|
|
138
|
+
* @throws \Dotenv\Exception\ValidationException
|
|
139
|
+
*
|
|
140
|
+
* @return \Dotenv\Validator
|
|
141
|
+
*/
|
|
142
|
+
public function allowedRegexValues(string $regex)
|
|
143
|
+
{
|
|
144
|
+
return $this->assertNullable(
|
|
145
|
+
static function (string $value) use ($regex) {
|
|
146
|
+
return Regex::matches($regex, $value)->success()->getOrElse(false);
|
|
147
|
+
},
|
|
148
|
+
\sprintf('does not match "%s"', $regex)
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Assert that the callback returns true for each variable.
|
|
154
|
+
*
|
|
155
|
+
* @param callable(?string):bool $callback
|
|
156
|
+
* @param string $message
|
|
157
|
+
*
|
|
158
|
+
* @throws \Dotenv\Exception\ValidationException
|
|
159
|
+
*
|
|
160
|
+
* @return \Dotenv\Validator
|
|
161
|
+
*/
|
|
162
|
+
public function assert(callable $callback, string $message)
|
|
163
|
+
{
|
|
164
|
+
$failing = [];
|
|
165
|
+
|
|
166
|
+
foreach ($this->variables as $variable) {
|
|
167
|
+
if ($callback($this->repository->get($variable)) === false) {
|
|
168
|
+
$failing[] = \sprintf('%s %s', $variable, $message);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (\count($failing) > 0) {
|
|
173
|
+
throw new ValidationException(\sprintf(
|
|
174
|
+
'One or more environment variables failed assertions: %s.',
|
|
175
|
+
\implode(', ', $failing)
|
|
176
|
+
));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return $this;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Assert that the callback returns true for each variable.
|
|
184
|
+
*
|
|
185
|
+
* Skip checking null variable values.
|
|
186
|
+
*
|
|
187
|
+
* @param callable(string):bool $callback
|
|
188
|
+
* @param string $message
|
|
189
|
+
*
|
|
190
|
+
* @throws \Dotenv\Exception\ValidationException
|
|
191
|
+
*
|
|
192
|
+
* @return \Dotenv\Validator
|
|
193
|
+
*/
|
|
194
|
+
public function assertNullable(callable $callback, string $message)
|
|
195
|
+
{
|
|
196
|
+
return $this->assert(
|
|
197
|
+
static function (?string $value) use ($callback) {
|
|
198
|
+
if ($value === null) {
|
|
199
|
+
return true;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return $callback($value);
|
|
203
|
+
},
|
|
204
|
+
$message
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
}
|
package/src/frontend/404.njk
CHANGED
|
@@ -7,10 +7,11 @@ layout: base.njk
|
|
|
7
7
|
<!-- !IMPORTANT -->
|
|
8
8
|
<!-- This is the only page that you need to modify statically -->
|
|
9
9
|
|
|
10
|
-
<div class="fade-in
|
|
10
|
+
<div class="fade-in not-found">
|
|
11
11
|
<h1>Oops! Page not found</h1>
|
|
12
12
|
<a href="/">Return to homepage</a>
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
|
+
|
|
15
16
|
{# You can also add the includes you need here below
|
|
16
17
|
{% include "component.njk" %} #}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<footer>
|
|
2
|
-
<div class="footer-top">
|
|
3
2
|
<div>
|
|
4
3
|
<h6>{{ site.title }}</h6>
|
|
5
4
|
<p>{{ site.description }}</p>
|
|
@@ -11,16 +10,18 @@
|
|
|
11
10
|
<li><a href="/">Homepage</a></li>
|
|
12
11
|
</ul>
|
|
13
12
|
</div>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
<div>
|
|
14
|
+
© {{ site.copyright.year }} {{ site.name }} {{ site.copyright.text }}
|
|
15
|
+
</div>
|
|
16
|
+
<div>
|
|
17
|
+
<h6>Legal</h6>
|
|
18
|
+
<small>
|
|
19
|
+
<ul>
|
|
20
|
+
<li><a href="{{ site.legal.privacy }}">Privacy Policy</a></li>
|
|
21
|
+
<li><a href="{{ site.legal.cookie }}">Cookie Policy</a></li>
|
|
22
|
+
<li><a href="{{ site.legal.terms }}">Terms and conditions</a></li>
|
|
23
|
+
</ul>
|
|
24
|
+
</small>
|
|
25
|
+
</div>
|
|
25
26
|
</div>
|
|
26
27
|
</footer>
|
|
@@ -6,10 +6,6 @@
|
|
|
6
6
|
<div class="nav-links">
|
|
7
7
|
<a class="btn" href="/">Homepage</a>
|
|
8
8
|
<a class="btn" href="/example-page">Example page</a>
|
|
9
|
-
<a class="btn" href="/about-us">About-us</a>
|
|
10
|
-
</div>
|
|
11
|
-
<div class="nav-links">
|
|
12
|
-
<a class="btn" href="/contact-us">Contact us</a>
|
|
13
9
|
</div>
|
|
14
10
|
</nav>
|
|
15
11
|
</header>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- This is the base of
|
|
1
|
+
<!-- This is the base of every page that you will create -->
|
|
2
2
|
|
|
3
3
|
<!DOCTYPE html>
|
|
4
4
|
<html lang="{{ site.lang or 'en' }}" data-bs-theme="{{ site.data_bs_theme or 'light' }}">
|
|
@@ -7,19 +7,28 @@
|
|
|
7
7
|
<meta charset="UTF-8">
|
|
8
8
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
{# Preconnect hints — establish early connections to external origins #}
|
|
11
|
+
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
|
|
12
|
+
|
|
13
|
+
{#╔══════════════════╗
|
|
14
|
+
║ PAGE DATA ║
|
|
15
|
+
╚══════════════════╝#}
|
|
16
|
+
|
|
11
17
|
{% set pageKey = title %}
|
|
12
18
|
{% set pageData = site.pages[pageKey] %}
|
|
13
19
|
|
|
14
|
-
|
|
20
|
+
{#╔══════════════════╗
|
|
21
|
+
║ SEO ║
|
|
22
|
+
╚══════════════════╝#}
|
|
23
|
+
|
|
15
24
|
<link rel="canonical" href="{{ site.url }}{{ page.url }}"/>
|
|
16
25
|
<title>{{ pageData.seo.title or title or site.title }}</title>
|
|
17
26
|
<meta name="description" content="{{ pageData.seo.description or site.description }}">
|
|
18
27
|
<meta name="keywords" content="{{ site.keywords }}">
|
|
19
28
|
<meta name="author" content="{{ site.author }}">
|
|
20
|
-
<meta name="theme-color" content=""
|
|
29
|
+
<meta name="theme-color" content="">
|
|
21
30
|
|
|
22
|
-
|
|
31
|
+
{# Open Graph #}
|
|
23
32
|
<meta property="og:title" content="{{ pageData.seo.title }}">
|
|
24
33
|
<meta property="og:description" content="{{ pageData.seo.description }}">
|
|
25
34
|
<meta property="og:type" content="website">
|
|
@@ -27,15 +36,16 @@
|
|
|
27
36
|
<meta property="og:image" content="{{ site.url }}{{ site.logo }}">
|
|
28
37
|
<meta property="og:site-name" content="{{ site.site-name }}">
|
|
29
38
|
|
|
30
|
-
|
|
39
|
+
{# Twitter Card #}
|
|
31
40
|
<meta name="twitter:card" content="summary_large_image">
|
|
32
41
|
<meta name="twitter:title" content="{{ pageData.seo.title }}">
|
|
33
42
|
<meta name="twitter:description" content="{{ pageData.seo.description }}">
|
|
34
43
|
<meta name="twitter:image" content="{{ site.url }}{{ site.logo }}">
|
|
35
44
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
{#╔══════════════════════════════════════════╗
|
|
46
|
+
║ JSON-LD — Structured data for SEO/AI ║
|
|
47
|
+
╚══════════════════════════════════════════╝#}
|
|
48
|
+
|
|
39
49
|
<script type="application/ld+json">
|
|
40
50
|
{
|
|
41
51
|
"@context": "https://schema.org",
|
|
@@ -58,67 +68,70 @@
|
|
|
58
68
|
}
|
|
59
69
|
</script>
|
|
60
70
|
|
|
61
|
-
|
|
71
|
+
{#╔══════════════════╗
|
|
72
|
+
║ FAVICON ║
|
|
73
|
+
╚══════════════════╝#}
|
|
74
|
+
|
|
62
75
|
<link rel="icon" type="image/svg+xml" href="{{ site.favicon }}">
|
|
63
|
-
<!-- (If you want to use a PNG favicon) -->
|
|
64
76
|
{#
|
|
65
77
|
<link rel="icon" type="image/png" href="/assets/favicon.png">
|
|
66
78
|
<link rel="apple-touch-icon" href="/assets/favicon.png">
|
|
67
79
|
#}
|
|
68
80
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
81
|
+
{#╔══════════════════╗
|
|
82
|
+
║ CSS ║
|
|
83
|
+
╚══════════════════╝#}
|
|
84
|
+
|
|
85
|
+
{# Markdown — theme-aware #}
|
|
86
|
+
{% if site.data_bs_theme == "dark" %}
|
|
87
|
+
<link rel="stylesheet" href="/css/github-markdown-dark.css">
|
|
88
|
+
{% else %}
|
|
89
|
+
<link rel="stylesheet" href="/css/github-markdown-light.css">
|
|
90
|
+
{% endif %}
|
|
91
|
+
|
|
92
|
+
{# Page CSS #}
|
|
93
|
+
<link rel="stylesheet" href="/css/pages/{{ title }}.css"/>
|
|
94
|
+
|
|
95
|
+
{# Per-page CDN CSS #}
|
|
74
96
|
{% if pageData and pageData.cdn and pageData.cdn.css %}
|
|
75
97
|
{% for link in pageData.cdn.css %}
|
|
76
98
|
<link rel="stylesheet" href="{{ link }}">
|
|
77
99
|
{% endfor %}
|
|
78
100
|
{% endif %}
|
|
101
|
+
|
|
79
102
|
</head>
|
|
80
103
|
|
|
81
104
|
<body>
|
|
82
|
-
|
|
105
|
+
|
|
83
106
|
{% include "global/header.njk" %}
|
|
84
107
|
|
|
85
|
-
<!-- Main -->
|
|
86
108
|
<main>
|
|
87
109
|
{{ content | safe }}
|
|
88
110
|
</main>
|
|
89
111
|
|
|
90
|
-
<!-- Footer -->
|
|
91
112
|
{% include "global/footer.njk" %}
|
|
92
113
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
╔═══════════════════════════════════════════╗
|
|
97
|
-
║ FRAMEWORK SCRIPTS ║
|
|
98
|
-
║ Uncomment the framework JS you are using ║
|
|
99
|
-
║ Bulma requires no JS — CSS only ║
|
|
100
|
-
╚═══════════════════════════════════════════╝
|
|
101
|
-
#}
|
|
114
|
+
{#╔══════════════════╗
|
|
115
|
+
║ SCRIPTS ║
|
|
116
|
+
╚══════════════════╝#}
|
|
102
117
|
|
|
103
|
-
{#
|
|
118
|
+
{# Framework — uncomment the one you are using #}
|
|
104
119
|
<script src="/js/bootstrap.bundle.min.js" defer></script>
|
|
105
|
-
|
|
106
|
-
{# Foundation JS — uncomment if using Foundation #}
|
|
107
120
|
{# <script src="/js/foundation.min.js" defer></script> #}
|
|
108
|
-
|
|
109
|
-
{# UIkit JS — uncomment if using UIkit #}
|
|
110
121
|
{# <script src="/js/uikit.min.js" defer></script> #}
|
|
111
122
|
{# <script src="/js/uikit-icons.min.js" defer></script> #}
|
|
112
|
-
|
|
113
123
|
{# Bulma — no JS needed #}
|
|
114
124
|
|
|
125
|
+
{# Per-page CDN JS #}
|
|
115
126
|
{% if pageData and pageData.cdn and pageData.cdn.js %}
|
|
116
127
|
{% for script in pageData.cdn.js %}
|
|
117
128
|
<script src="{{ script }}" defer></script>
|
|
118
129
|
{% endfor %}
|
|
119
130
|
{% endif %}
|
|
120
131
|
|
|
132
|
+
{# Page JS #}
|
|
121
133
|
<script src="/js/pages/{{ title }}.js"></script>
|
|
134
|
+
|
|
122
135
|
</body>
|
|
123
136
|
|
|
124
137
|
</html>
|