├── .devcontainer └── devcontainer.json ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── update-remote.yml ├── .gitignore ├── .htaccess ├── 403.php ├── 404.php ├── CODE_OF_CONDUCT.md ├── LICENSE ├── assets ├── analytics.php ├── images │ ├── favicon.png │ ├── flags │ │ ├── ar.svg │ │ ├── az.png │ │ ├── cz.svg │ │ ├── de.svg │ │ ├── eo.svg │ │ ├── es.svg │ │ ├── fr.svg │ │ ├── gr.svg │ │ ├── id.svg │ │ ├── it.svg │ │ ├── lu.svg │ │ ├── nl.svg │ │ ├── ru.svg │ │ ├── tr.svg │ │ ├── uk.svg │ │ └── zh_tw.svg │ ├── music_note.png │ └── no_song.png ├── js │ ├── alpine.min.js │ ├── playing.js │ ├── scripts.js │ └── spotify-web-api.js ├── lang │ ├── ar.php │ ├── az.php │ ├── cz.php │ ├── de.php │ ├── en.php │ ├── eo.php │ ├── es.php │ ├── fr.php │ ├── gr.php │ ├── id.php │ ├── it.php │ ├── jp.php │ ├── lu.php │ ├── nl.php │ ├── pl.php │ ├── ru.php │ ├── tr.php │ └── zh_tw.php └── links.php ├── composer.json ├── composer.lock ├── example.env ├── generate_miniplayer.php ├── index.php ├── lang.php ├── lib ├── spotify_api.php └── spotify_session.php ├── login.php ├── miniplayer.php ├── playing.php ├── readme.md ├── screenshots ├── miniplayer.png └── regular.png ├── token.php └── vendor ├── autoload.php ├── composer ├── ClassLoader.php ├── InstalledVersions.php ├── LICENSE ├── autoload_classmap.php ├── autoload_files.php ├── autoload_namespaces.php ├── autoload_psr4.php ├── autoload_real.php ├── autoload_static.php ├── installed.json ├── installed.php └── platform_check.php ├── graham-campbell └── result-type │ ├── LICENSE │ ├── composer.json │ └── src │ ├── Error.php │ ├── Result.php │ └── Success.php ├── jwilsson └── spotify-web-api-php │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── LICENSE.md │ ├── README.md │ ├── composer.json │ ├── docs │ ├── README.md │ └── getting-started.md │ ├── phpcs.xml │ ├── phpunit.php │ ├── phpunit.xml.dist │ ├── src │ ├── Request.php │ ├── Session.php │ ├── SpotifyWebAPI.php │ ├── SpotifyWebAPIAuthException.php │ ├── SpotifyWebAPIException.php │ └── cacert.pem │ └── tests │ ├── RequestTest.php │ ├── SessionTest.php │ ├── SpotifyWebAPITest.php │ └── fixtures │ ├── access-token.json │ ├── album-tracks.json │ ├── album.json │ ├── albums.json │ ├── artist-related-artists.json │ ├── artist-top-tracks.json │ ├── artist.json │ ├── artists.json │ ├── audio-analysis.json │ ├── audio-features.json │ ├── available-genre-seeds.json │ ├── categories-list.json │ ├── category-playlists.json │ ├── category.json │ ├── featured-playlists.json │ ├── new-releases.json │ ├── recently-played.json │ ├── recommendations.json │ ├── refresh-token-no-refresh-token.json │ ├── refresh-token.json │ ├── search-album.json │ ├── snapshot-id.json │ ├── top-artists-and-tracks.json │ ├── track.json │ ├── tracks.json │ ├── user-albums-contains.json │ ├── user-current-playback-info.json │ ├── user-current-track.json │ ├── user-devices.json │ ├── user-followed-artists.json │ ├── user-follows-playlist.json │ ├── user-follows.json │ ├── user-playlist-tracks.json │ ├── user-playlist.json │ ├── user-playlists.json │ ├── user-tracks-contains.json │ ├── user-tracks.json │ ├── user.json │ └── users-follows-playlist.json ├── phpoption └── phpoption │ ├── LICENSE │ ├── Makefile │ ├── composer.json │ └── src │ └── PhpOption │ ├── LazyOption.php │ ├── None.php │ ├── Option.php │ └── Some.php ├── symfony ├── polyfill-ctype │ ├── Ctype.php │ ├── LICENSE │ ├── README.md │ ├── bootstrap.php │ ├── bootstrap80.php │ └── composer.json ├── polyfill-mbstring │ ├── LICENSE │ ├── Mbstring.php │ ├── README.md │ ├── Resources │ │ └── unidata │ │ │ ├── lowerCase.php │ │ │ ├── titleCaseRegexp.php │ │ │ └── upperCase.php │ ├── bootstrap.php │ ├── bootstrap80.php │ └── composer.json └── polyfill-php80 │ ├── LICENSE │ ├── Php80.php │ ├── README.md │ ├── Resources │ └── stubs │ │ ├── Attribute.php │ │ ├── Stringable.php │ │ ├── UnhandledMatchError.php │ │ └── ValueError.php │ ├── bootstrap.php │ └── composer.json └── vlucas └── phpdotenv ├── LICENSE ├── composer.json └── src ├── Dotenv.php ├── Exception ├── ExceptionInterface.php ├── InvalidEncodingException.php ├── InvalidFileException.php ├── InvalidPathException.php └── ValidationException.php ├── Loader ├── Loader.php ├── LoaderInterface.php └── Resolver.php ├── Parser ├── Entry.php ├── EntryParser.php ├── Lexer.php ├── Lines.php ├── Parser.php ├── ParserInterface.php └── Value.php ├── Repository ├── Adapter │ ├── AdapterInterface.php │ ├── ApacheAdapter.php │ ├── ArrayAdapter.php │ ├── EnvConstAdapter.php │ ├── GuardedWriter.php │ ├── ImmutableWriter.php │ ├── MultiReader.php │ ├── MultiWriter.php │ ├── PutenvAdapter.php │ ├── ReaderInterface.php │ ├── ReplacingWriter.php │ ├── ServerConstAdapter.php │ └── WriterInterface.php ├── AdapterRepository.php ├── RepositoryBuilder.php └── RepositoryInterface.php ├── Store ├── File │ ├── Paths.php │ └── Reader.php ├── FileStore.php ├── StoreBuilder.php ├── StoreInterface.php └── StringStore.php ├── Util ├── Regex.php └── Str.php └── Validator.php /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/devcontainers/templates/tree/main/src/php 3 | { 4 | "name": "PHP", 5 | // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile 6 | "image": "mcr.microsoft.com/devcontainers/php:1-8.2-bullseye", 7 | 8 | // Features to add to the dev container. More info: https://containers.dev/features. 9 | // "features": {}, 10 | 11 | // Configure tool-specific properties. 12 | // "customizations": {}, 13 | 14 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 15 | "forwardPorts": [ 16 | 8080 17 | ], 18 | "features": { 19 | "ghcr.io/devcontainers-contrib/features/zsh-plugins:0": {}, 20 | "ghcr.io/stuartleeks/dev-container-features/shell-history:0": {} 21 | }, 22 | 23 | // Use 'postCreateCommand' to run commands after the container is created. 24 | "postCreateCommand": "sudo a2enmod rewrite && sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html && service apache2 restart" 25 | 26 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 27 | // "remoteUser": "root" 28 | } 29 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: busybox11 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: busybox11 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: ['paypal.me/busybox11'] 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/update-remote.yml: -------------------------------------------------------------------------------- 1 | name: Update remote server 2 | on: [push] 3 | jobs: 4 | 5 | update: 6 | name: Update 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: executing remote ssh commands using password 10 | uses: appleboy/ssh-action@master 11 | env: 12 | SCRIPT_STR: ${{ secrets.SSH_SCRIPT }} 13 | with: 14 | host: ${{ secrets.SSH_SERVER }} 15 | username: ${{ secrets.SSH_USERNAME }} 16 | key: ${{ secrets.SSH_PRIVATE_KEY }} 17 | envs: SCRIPT_STR, GITHUB_REF_NAME 18 | script: | 19 | $SCRIPT_STR $GITHUB_REF_NAME 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | .DS_Store -------------------------------------------------------------------------------- /.htaccess: -------------------------------------------------------------------------------- 1 | ErrorDocument 404 /404.php 2 | ErrorDocument 403 /403.php 3 | 4 | RedirectMatch 403 /.env 5 | 6 | # vendor 7 | RedirectMatch 403 /vendor(/|$) 8 | 9 | # disable .git folder 10 | RedirectMatch 404 /\.git 11 | 12 | # disable .devcontainer, .vscode, .github folders 13 | RedirectMatch 404 /(\.devcontainer|\.vscode|\.github) 14 | 15 | # disable directory browsing 16 | Options -Indexes 17 | 18 | # disable server signature 19 | ServerSignature Off 20 | 21 | # disable php errors 22 | php_flag display_errors Off 23 | php_flag display_startup_errors Off 24 | -------------------------------------------------------------------------------- /403.php: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 |
21 |
18 | *
19 | * @internal
20 | */
21 | final class Php80
22 | {
23 | public static function fdiv(float $dividend, float $divisor): float
24 | {
25 | return @($dividend / $divisor);
26 | }
27 |
28 | public static function get_debug_type($value): string
29 | {
30 | switch (true) {
31 | case null === $value: return 'null';
32 | case \is_bool($value): return 'bool';
33 | case \is_string($value): return 'string';
34 | case \is_array($value): return 'array';
35 | case \is_int($value): return 'int';
36 | case \is_float($value): return 'float';
37 | case \is_object($value): break;
38 | case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
39 | default:
40 | if (null === $type = @get_resource_type($value)) {
41 | return 'unknown';
42 | }
43 |
44 | if ('Unknown' === $type) {
45 | $type = 'closed';
46 | }
47 |
48 | return "resource ($type)";
49 | }
50 |
51 | $class = \get_class($value);
52 |
53 | if (false === strpos($class, '@')) {
54 | return $class;
55 | }
56 |
57 | return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous';
58 | }
59 |
60 | public static function get_resource_id($res): int
61 | {
62 | if (!\is_resource($res) && null === @get_resource_type($res)) {
63 | throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res)));
64 | }
65 |
66 | return (int) $res;
67 | }
68 |
69 | public static function preg_last_error_msg(): string
70 | {
71 | switch (preg_last_error()) {
72 | case \PREG_INTERNAL_ERROR:
73 | return 'Internal error';
74 | case \PREG_BAD_UTF8_ERROR:
75 | return 'Malformed UTF-8 characters, possibly incorrectly encoded';
76 | case \PREG_BAD_UTF8_OFFSET_ERROR:
77 | return 'The offset did not correspond to the beginning of a valid UTF-8 code point';
78 | case \PREG_BACKTRACK_LIMIT_ERROR:
79 | return 'Backtrack limit exhausted';
80 | case \PREG_RECURSION_LIMIT_ERROR:
81 | return 'Recursion limit exhausted';
82 | case \PREG_JIT_STACKLIMIT_ERROR:
83 | return 'JIT stack limit exhausted';
84 | case \PREG_NO_ERROR:
85 | return 'No error';
86 | default:
87 | return 'Unknown error';
88 | }
89 | }
90 |
91 | public static function str_contains(string $haystack, string $needle): bool
92 | {
93 | return '' === $needle || false !== strpos($haystack, $needle);
94 | }
95 |
96 | public static function str_starts_with(string $haystack, string $needle): bool
97 | {
98 | return 0 === strncmp($haystack, $needle, \strlen($needle));
99 | }
100 |
101 | public static function str_ends_with(string $haystack, string $needle): bool
102 | {
103 | return '' === $needle || ('' !== $haystack && 0 === substr_compare($haystack, $needle, -\strlen($needle)));
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/vendor/symfony/polyfill-php80/README.md:
--------------------------------------------------------------------------------
1 | Symfony Polyfill / Php80
2 | ========================
3 |
4 | This component provides features added to PHP 8.0 core:
5 |
6 | - `Stringable` interface
7 | - [`fdiv`](https://php.net/fdiv)
8 | - `ValueError` class
9 | - `UnhandledMatchError` class
10 | - `FILTER_VALIDATE_BOOL` constant
11 | - [`get_debug_type`](https://php.net/get_debug_type)
12 | - [`preg_last_error_msg`](https://php.net/preg_last_error_msg)
13 | - [`str_contains`](https://php.net/str_contains)
14 | - [`str_starts_with`](https://php.net/str_starts_with)
15 | - [`str_ends_with`](https://php.net/str_ends_with)
16 | - [`get_resource_id`](https://php.net/get_resource_id)
17 |
18 | More information can be found in the
19 | [main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md).
20 |
21 | License
22 | =======
23 |
24 | This library is released under the [MIT license](LICENSE).
25 |
--------------------------------------------------------------------------------
/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php:
--------------------------------------------------------------------------------
1 | flags = $flags;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | use Symfony\Polyfill\Php80 as p;
13 |
14 | if (\PHP_VERSION_ID >= 80000) {
15 | return;
16 | }
17 |
18 | if (!defined('FILTER_VALIDATE_BOOL') && defined('FILTER_VALIDATE_BOOLEAN')) {
19 | define('FILTER_VALIDATE_BOOL', \FILTER_VALIDATE_BOOLEAN);
20 | }
21 |
22 | if (!function_exists('fdiv')) {
23 | function fdiv(float $num1, float $num2): float { return p\Php80::fdiv($num1, $num2); }
24 | }
25 | if (!function_exists('preg_last_error_msg')) {
26 | function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); }
27 | }
28 | if (!function_exists('str_contains')) {
29 | function str_contains(?string $haystack, ?string $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); }
30 | }
31 | if (!function_exists('str_starts_with')) {
32 | function str_starts_with(?string $haystack, ?string $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); }
33 | }
34 | if (!function_exists('str_ends_with')) {
35 | function str_ends_with(?string $haystack, ?string $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); }
36 | }
37 | if (!function_exists('get_debug_type')) {
38 | function get_debug_type($value): string { return p\Php80::get_debug_type($value); }
39 | }
40 | if (!function_exists('get_resource_id')) {
41 | function get_resource_id($resource): int { return p\Php80::get_resource_id($resource); }
42 | }
43 |
--------------------------------------------------------------------------------
/vendor/symfony/polyfill-php80/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "symfony/polyfill-php80",
3 | "type": "library",
4 | "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
5 | "keywords": ["polyfill", "shim", "compatibility", "portable"],
6 | "homepage": "https://symfony.com",
7 | "license": "MIT",
8 | "authors": [
9 | {
10 | "name": "Ion Bazan",
11 | "email": "ion.bazan@gmail.com"
12 | },
13 | {
14 | "name": "Nicolas Grekas",
15 | "email": "p@tchwork.com"
16 | },
17 | {
18 | "name": "Symfony Community",
19 | "homepage": "https://symfony.com/contributors"
20 | }
21 | ],
22 | "require": {
23 | "php": ">=7.1"
24 | },
25 | "autoload": {
26 | "psr-4": { "Symfony\\Polyfill\\Php80\\": "" },
27 | "files": [ "bootstrap.php" ],
28 | "classmap": [ "Resources/stubs" ]
29 | },
30 | "minimum-stability": "dev",
31 | "extra": {
32 | "branch-alias": {
33 | "dev-main": "1.23-dev"
34 | },
35 | "thanks": {
36 | "name": "symfony/polyfill",
37 | "url": "https://github.com/symfony/polyfill"
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/vendor/vlucas/phpdotenv/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2014, Graham Campbell.
4 | Copyright (c) 2013, Vance Lucas.
5 | All rights reserved.
6 |
7 | Redistribution and use in source and binary forms, with or without
8 | modification, are permitted provided that the following conditions are met:
9 |
10 | 1. Redistributions of source code must retain the above copyright notice, this
11 | list of conditions and the following disclaimer.
12 |
13 | 2. Redistributions in binary form must reproduce the above copyright notice,
14 | this list of conditions and the following disclaimer in the documentation
15 | and/or other materials provided with the distribution.
16 |
17 | 3. Neither the name of the copyright holder nor the names of its
18 | contributors may be used to endorse or promote products derived from
19 | this software without specific prior written permission.
20 |
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 |
--------------------------------------------------------------------------------
/vendor/vlucas/phpdotenv/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vlucas/phpdotenv",
3 | "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
4 | "keywords": ["env", "dotenv", "environment"],
5 | "license": "BSD-3-Clause",
6 | "authors": [
7 | {
8 | "name": "Graham Campbell",
9 | "email": "graham@alt-three.com",
10 | "homepage": "https://gjcampbell.co.uk/"
11 | },
12 | {
13 | "name": "Vance Lucas",
14 | "email": "vance@vancelucas.com",
15 | "homepage": "https://vancelucas.com/"
16 | }
17 | ],
18 | "require": {
19 | "php": "^7.1.3 || ^8.0",
20 | "ext-pcre": "*",
21 | "graham-campbell/result-type": "^1.0.1",
22 | "phpoption/phpoption": "^1.7.4",
23 | "symfony/polyfill-ctype": "^1.17",
24 | "symfony/polyfill-mbstring": "^1.17",
25 | "symfony/polyfill-php80": "^1.17"
26 | },
27 | "require-dev": {
28 | "ext-filter": "*",
29 | "bamarni/composer-bin-plugin": "^1.4.1",
30 | "phpunit/phpunit": "^7.5.20 || ^8.5.14 || ^9.5.1"
31 | },
32 | "autoload": {
33 | "psr-4": {
34 | "Dotenv\\": "src/"
35 | }
36 | },
37 | "autoload-dev": {
38 | "psr-4": {
39 | "Dotenv\\Tests\\": "tests/Dotenv/"
40 | }
41 | },
42 | "suggest": {
43 | "ext-filter": "Required to use the boolean validator."
44 | },
45 | "config": {
46 | "preferred-install": "dist"
47 | },
48 | "extra": {
49 | "branch-alias": {
50 | "dev-master": "5.3-dev"
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/vendor/vlucas/phpdotenv/src/Exception/ExceptionInterface.php:
--------------------------------------------------------------------------------
1 |
23 | */
24 | public function load(RepositoryInterface $repository, array $entries)
25 | {
26 | return \array_reduce($entries, static function (array $vars, Entry $entry) use ($repository) {
27 | $name = $entry->getName();
28 |
29 | $value = $entry->getValue()->map(static function (Value $value) use ($repository) {
30 | return Resolver::resolve($repository, $value);
31 | });
32 |
33 | if ($value->isDefined()) {
34 | $inner = $value->get();
35 | if ($repository->set($name, $inner)) {
36 | return \array_merge($vars, [$name => $inner]);
37 | }
38 | } else {
39 | if ($repository->clear($name)) {
40 | return \array_merge($vars, [$name => null]);
41 | }
42 | }
43 |
44 | return $vars;
45 | }, []);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/vendor/vlucas/phpdotenv/src/Loader/LoaderInterface.php:
--------------------------------------------------------------------------------
1 |
18 | */
19 | public function load(RepositoryInterface $repository, array $entries);
20 | }
21 |
--------------------------------------------------------------------------------
/vendor/vlucas/phpdotenv/src/Loader/Resolver.php:
--------------------------------------------------------------------------------
1 | getVars(), static function (string $s, int $i) use ($repository) {
41 | return Str::substr($s, 0, $i).self::resolveVariable($repository, Str::substr($s, $i));
42 | }, $value->getChars());
43 | }
44 |
45 | /**
46 | * Resolve a single nested variable.
47 | *
48 | * @param \Dotenv\Repository\RepositoryInterface $repository
49 | * @param string $str
50 | *
51 | * @return string
52 | */
53 | private static function resolveVariable(RepositoryInterface $repository, string $str)
54 | {
55 | return Regex::replaceCallback(
56 | '/\A\${([a-zA-Z0-9_.]+)}/',
57 | static function (array $matches) use ($repository) {
58 | return Option::fromValue($repository->get($matches[1]))
59 | ->getOrElse($matches[0]);
60 | },
61 | $str,
62 | 1
63 | )->success()->getOrElse($str);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/vendor/vlucas/phpdotenv/src/Parser/Entry.php:
--------------------------------------------------------------------------------
1 | name = $name;
36 | $this->value = $value;
37 | }
38 |
39 | /**
40 | * Get the entry name.
41 | *
42 | * @return string
43 | */
44 | public function getName()
45 | {
46 | return $this->name;
47 | }
48 |
49 | /**
50 | * Get the entry value.
51 | *
52 | * @return \PhpOption\Option<\Dotenv\Parser\Value>
53 | */
54 | public function getValue()
55 | {
56 | /** @var \PhpOption\Option<\Dotenv\Parser\Value> */
57 | return Option::fromValue($this->value);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/vendor/vlucas/phpdotenv/src/Parser/Lexer.php:
--------------------------------------------------------------------------------
1 |
39 | */
40 | public static function lex(string $content)
41 | {
42 | static $regex;
43 |
44 | if ($regex === null) {
45 | $regex = '(('.\implode(')|(', self::PATTERNS).'))A';
46 | }
47 |
48 | $tokens = [];
49 |
50 | $offset = 0;
51 |
52 | while (isset($content[$offset])) {
53 | if (!\preg_match($regex, $content, $matches, 0, $offset)) {
54 | throw new \Error(\sprintf('Lexer encountered unexpected character [%s].', $content[$offset]));
55 | }
56 |
57 | $offset += \strlen($matches[0]);
58 |
59 | yield $matches[0];
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/vendor/vlucas/phpdotenv/src/Parser/Lines.php:
--------------------------------------------------------------------------------
1 | map(static function () use ($line) {
89 | return self::looksLikeMultilineStop($line, true) === false;
90 | })->getOrElse(false);
91 | }
92 |
93 | /**
94 | * Determine if the given line can be the start of a multiline variable.
95 | *
96 | * @param string $line
97 | * @param bool $started
98 | *
99 | * @return bool
100 | */
101 | private static function looksLikeMultilineStop(string $line, bool $started)
102 | {
103 | if ($line === '"') {
104 | return true;
105 | }
106 |
107 | return Regex::occurences('/(?=([^\\\\]"))/', \str_replace('\\\\', '', $line))->map(static function (int $count) use ($started) {
108 | return $started ? $count > 1 : $count >= 1;
109 | })->success()->getOrElse(false);
110 | }
111 |
112 | /**
113 | * Determine if the line in the file is a comment or whitespace.
114 | *
115 | * @param string $line
116 | *
117 | * @return bool
118 | */
119 | private static function isCommentOrWhitespace(string $line)
120 | {
121 | $line = \trim($line);
122 |
123 | return $line === '' || (isset($line[0]) && $line[0] === '#');
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/vendor/vlucas/phpdotenv/src/Parser/Parser.php:
--------------------------------------------------------------------------------
1 | mapError(static function () {
26 | return 'Could not split into separate lines.';
27 | })->flatMap(static function (array $lines) {
28 | return self::process(Lines::process($lines));
29 | })->mapError(static function (string $error) {
30 | throw new InvalidFileException(\sprintf('Failed to parse dotenv file. %s', $error));
31 | })->success()->get();
32 | }
33 |
34 | /**
35 | * Convert the raw entries into proper entries.
36 | *
37 | * @param string[] $entries
38 | *
39 | * @return \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Entry[],string>
40 | */
41 | private static function process(array $entries)
42 | {
43 | /** @var \GrahamCampbell\ResultType\Result<\Dotenv\Parser\Entry[],string> */
44 | return \array_reduce($entries, static function (Result $result, string $raw) {
45 | return $result->flatMap(static function (array $entries) use ($raw) {
46 | return EntryParser::parse($raw)->map(static function (Entry $entry) use ($entries) {
47 | return \array_merge($entries, [$entry]);
48 | });
49 | });
50 | }, Success::create([]));
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/vendor/vlucas/phpdotenv/src/Parser/ParserInterface.php:
--------------------------------------------------------------------------------
1 | chars = $chars;
36 | $this->vars = $vars;
37 | }
38 |
39 | /**
40 | * Create an empty value instance.
41 | *
42 | * @return \Dotenv\Parser\Value
43 | */
44 | public static function blank()
45 | {
46 | return new self('', []);
47 | }
48 |
49 | /**
50 | * Create a new value instance, appending the characters.
51 | *
52 | * @param string $chars
53 | * @param bool $var
54 | *
55 | * @return \Dotenv\Parser\Value
56 | */
57 | public function append(string $chars, bool $var)
58 | {
59 | return new self(
60 | $this->chars.$chars,
61 | $var ? \array_merge($this->vars, [Str::len($this->chars)]) : $this->vars
62 | );
63 | }
64 |
65 | /**
66 | * Get the string representation of the parsed value.
67 | *
68 | * @return string
69 | */
70 | public function getChars()
71 | {
72 | return $this->chars;
73 | }
74 |
75 | /**
76 | * Get the locations of the variables in the value.
77 | *
78 | * @return int[]
79 | */
80 | public function getVars()
81 | {
82 | $vars = $this->vars;
83 |
84 | \rsort($vars);
85 |
86 | return $vars;
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/vendor/vlucas/phpdotenv/src/Repository/Adapter/AdapterInterface.php:
--------------------------------------------------------------------------------
1 |
13 | */
14 | public static function create();
15 | }
16 |
--------------------------------------------------------------------------------
/vendor/vlucas/phpdotenv/src/Repository/Adapter/ApacheAdapter.php:
--------------------------------------------------------------------------------
1 |
27 | */
28 | public static function create()
29 | {
30 | if (self::isSupported()) {
31 | /** @var \PhpOption\Option