create-berna-stencil 1.0.35 → 1.0.37
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/_tools/res/templates/template.js +18 -22
- package/_tools/res/templates/template.njk +8 -8
- package/_tools/res/templates/template.scss +16 -16
- package/bin/create.js +1 -1
- package/package.json +70 -70
- package/src/404.njk +2 -2
- package/src/api/core/composer.lock +492 -492
- package/src/api/core/vendor/composer/autoload_static.php +10 -10
- package/src/api/core/vendor/composer/installed.json +6 -6
- 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/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/components/global/header.njk +4 -8
- package/src/components/welcome.njk +20 -12
- package/src/data/site.json +43 -43
- package/src/js/pages/404.js +0 -3
- package/src/js/pages/homepage.js +0 -6
- package/src/scss/modules/_buttons.scss +17 -0
- package/src/scss/modules/_footer.scss +1 -1
- package/src/scss/modules/_global.scss +3 -0
- package/src/scss/modules/_header.scss +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/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
- package/src/data/lang.json +0 -30
- package/src/js/modules/forms/form.js +0 -45
- package/src/js/modules/langSwitcher.js +0 -69
|
@@ -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
|
+
}
|
|
@@ -4,16 +4,12 @@
|
|
|
4
4
|
<img src="{{ site.logo }}" alt="{{ site.title }}" height="40">
|
|
5
5
|
</a>
|
|
6
6
|
<div class="nav-links">
|
|
7
|
-
<a class="btn
|
|
8
|
-
<a class="btn
|
|
9
|
-
<a class="btn
|
|
7
|
+
<a class="btn" href="/">Homepage</a>
|
|
8
|
+
<a class="btn" href="/about-us">About-us</a>
|
|
9
|
+
<a class="btn" href="/work-with-us">Work with us</a>
|
|
10
10
|
</div>
|
|
11
11
|
<div class="nav-links">
|
|
12
|
-
<
|
|
13
|
-
{# enLangName or itLangName is the key that contains the language name accordint to the current language #}
|
|
14
|
-
<option value="en" data-lang-key="enLangName"></option>
|
|
15
|
-
<option value="it" data-lang-key="itLangName"></option>
|
|
16
|
-
</select>
|
|
12
|
+
<a class="btn" href="/contact-us">Contact us</a>
|
|
17
13
|
</div>
|
|
18
14
|
</nav>
|
|
19
15
|
</header>
|
|
@@ -3,22 +3,30 @@
|
|
|
3
3
|
<div class="slogan">The framework you need, simplified</div>
|
|
4
4
|
|
|
5
5
|
<div class="grid">
|
|
6
|
-
<a
|
|
6
|
+
<a
|
|
7
|
+
href="https://bernastencil.com"
|
|
8
|
+
class="card"
|
|
9
|
+
target="_blank"
|
|
10
|
+
rel="noopener noreferrer"
|
|
11
|
+
>
|
|
7
12
|
<i class="bi bi-book card-icon" aria-hidden="true"></i>
|
|
8
13
|
<h3>Documentation</h3>
|
|
9
|
-
<p>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
></span>
|
|
14
|
+
<p>
|
|
15
|
+
Everything you need to get started, from setup to advanced topics and customizations
|
|
16
|
+
</p>
|
|
17
|
+
<span class="card-link">Go to documentation <span class="bi bi-arrow-right"></span></span>
|
|
13
18
|
</a>
|
|
14
19
|
|
|
15
|
-
<a
|
|
20
|
+
<a
|
|
21
|
+
href="https://github.com/rhaastrake/berna-stencil"
|
|
22
|
+
class="card"
|
|
23
|
+
target="_blank"
|
|
24
|
+
rel="noopener noreferrer"
|
|
25
|
+
>
|
|
16
26
|
<i class="bi bi-github card-icon" aria-hidden="true"></i>
|
|
17
|
-
<h3>
|
|
27
|
+
<h3>Github repository</h3>
|
|
18
28
|
<p>Community-driven. Contributions, issues and PRs are welcome.</p>
|
|
19
|
-
<span class="card-link"
|
|
20
|
-
>GitHub <i class="bi bi-arrow-right" aria-hidden="true"></i
|
|
21
|
-
></span>
|
|
29
|
+
<span class="card-link">Open the repository <span class="bi bi-arrow-right"></span></span>
|
|
22
30
|
</a>
|
|
23
31
|
</div>
|
|
24
32
|
</div>
|
|
@@ -67,7 +75,7 @@
|
|
|
67
75
|
}
|
|
68
76
|
.card p {
|
|
69
77
|
font-size: 1rem;
|
|
70
|
-
color: #
|
|
78
|
+
color: #38649b;
|
|
71
79
|
line-height: 1.6;
|
|
72
80
|
}
|
|
73
81
|
.card-link {
|
|
@@ -76,7 +84,7 @@
|
|
|
76
84
|
gap: 4px;
|
|
77
85
|
font-size: 1rem;
|
|
78
86
|
color: #42b883;
|
|
79
|
-
opacity: 0.
|
|
87
|
+
opacity: 0.8;
|
|
80
88
|
transition: opacity 0.15s;
|
|
81
89
|
}
|
|
82
90
|
.card:hover .card-link {
|
package/src/data/site.json
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
{
|
|
2
|
-
"site_name": "Site name",
|
|
3
|
-
"title": "Site title",
|
|
4
|
-
"description": "Site description",
|
|
5
|
-
"keywords": "keyword1, keyword2, keyword3",
|
|
6
|
-
"domain": "yoursite.com",
|
|
7
|
-
"url": "https://yoursite.com",
|
|
8
|
-
"lang": "en",
|
|
9
|
-
"author": "Name and surname",
|
|
10
|
-
"data_bs_theme": "dark",
|
|
11
|
-
"favicon": "/assets/brand/favicon.svg",
|
|
12
|
-
"logo": "/assets/brand/logo.svg",
|
|
13
|
-
"copyright": {
|
|
14
|
-
"year": "2026",
|
|
15
|
-
"text": "Copyright text"
|
|
16
|
-
},
|
|
17
|
-
"legal": {
|
|
18
|
-
"privacy": "",
|
|
19
|
-
"cookie": "",
|
|
20
|
-
"cookieControls": "",
|
|
21
|
-
"terms": ""
|
|
22
|
-
},
|
|
23
|
-
"pages": {
|
|
24
|
-
"404": {
|
|
25
|
-
"seo": {
|
|
26
|
-
"title": "404 - Not found"
|
|
27
|
-
},
|
|
28
|
-
"cdn": {
|
|
29
|
-
"css": [],
|
|
30
|
-
"js": []
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"homepage": {
|
|
34
|
-
"seo": {
|
|
35
|
-
"title": "Homepage",
|
|
36
|
-
"description": "Description"
|
|
37
|
-
},
|
|
38
|
-
"cdn": {
|
|
39
|
-
"css": [],
|
|
40
|
-
"js": []
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"site_name": "Site name",
|
|
3
|
+
"title": "Site title",
|
|
4
|
+
"description": "Site description",
|
|
5
|
+
"keywords": "keyword1, keyword2, keyword3",
|
|
6
|
+
"domain": "yoursite.com",
|
|
7
|
+
"url": "https://yoursite.com",
|
|
8
|
+
"lang": "en",
|
|
9
|
+
"author": "Name and surname",
|
|
10
|
+
"data_bs_theme": "dark",
|
|
11
|
+
"favicon": "/assets/brand/favicon.svg",
|
|
12
|
+
"logo": "/assets/brand/logo.svg",
|
|
13
|
+
"copyright": {
|
|
14
|
+
"year": "2026",
|
|
15
|
+
"text": "Copyright text"
|
|
16
|
+
},
|
|
17
|
+
"legal": {
|
|
18
|
+
"privacy": "",
|
|
19
|
+
"cookie": "",
|
|
20
|
+
"cookieControls": "",
|
|
21
|
+
"terms": ""
|
|
22
|
+
},
|
|
23
|
+
"pages": {
|
|
24
|
+
"404": {
|
|
25
|
+
"seo": {
|
|
26
|
+
"title": "404 - Not found"
|
|
27
|
+
},
|
|
28
|
+
"cdn": {
|
|
29
|
+
"css": [],
|
|
30
|
+
"js": []
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"homepage": {
|
|
34
|
+
"seo": {
|
|
35
|
+
"title": "Homepage",
|
|
36
|
+
"description": "Description"
|
|
37
|
+
},
|
|
38
|
+
"cdn": {
|
|
39
|
+
"css": [],
|
|
40
|
+
"js": []
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
44
|
}
|
package/src/js/pages/404.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
// JAVASCRIPT MODULES IMPORTS
|
|
3
3
|
//==========================
|
|
4
4
|
|
|
5
|
-
// Call inside DOMContentLoaded
|
|
6
|
-
import { initLangSwitcher } from '../modules/langSwitcher.js';
|
|
7
5
|
|
|
8
6
|
// Call anywhere
|
|
9
7
|
import { showNotification } from '../modules/notification.js';
|
|
@@ -17,7 +15,6 @@ import { showNotification } from '../modules/notification.js';
|
|
|
17
15
|
//==========================
|
|
18
16
|
|
|
19
17
|
document.addEventListener("DOMContentLoaded", () => {
|
|
20
|
-
initLangSwitcher();
|
|
21
18
|
});
|
|
22
19
|
|
|
23
20
|
showNotification("404 notification", "success", 3000);
|
package/src/js/pages/homepage.js
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
// JAVASCRIPT MODULES IMPORTS
|
|
3
3
|
//==========================
|
|
4
4
|
|
|
5
|
-
// Call inside DOMContentLoaded
|
|
6
|
-
import { initFormListener } from '../modules/forms/form.js';
|
|
7
|
-
import { initLangSwitcher } from '../modules/langSwitcher.js';
|
|
8
|
-
|
|
9
5
|
// Call anywhere
|
|
10
6
|
import { showNotification } from '../modules/notification.js';
|
|
11
7
|
|
|
@@ -18,8 +14,6 @@ import { showNotification } from '../modules/notification.js';
|
|
|
18
14
|
//==========================
|
|
19
15
|
|
|
20
16
|
document.addEventListener("DOMContentLoaded", () => {
|
|
21
|
-
initLangSwitcher();
|
|
22
|
-
initFormListener();
|
|
23
17
|
});
|
|
24
18
|
|
|
25
19
|
showNotification("Example notification", "success", 3000);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//==========================
|
|
2
|
+
// CSS RULES FOR BUTTONS
|
|
3
|
+
//==========================
|
|
4
|
+
|
|
5
|
+
// Getting root rules from _root.scss
|
|
6
|
+
@use 'root' as root;
|
|
7
|
+
|
|
8
|
+
.btn {
|
|
9
|
+
color: #42b883;
|
|
10
|
+
border-radius: 12px;
|
|
11
|
+
padding: 8px 20px;
|
|
12
|
+
transition: background 0.2s, color 0.2s;
|
|
13
|
+
}
|
|
14
|
+
.btn:hover {
|
|
15
|
+
background: #42b883;
|
|
16
|
+
color: #0d1526;
|
|
17
|
+
}
|