allow vendord
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
This commit is contained in:
2
vendor/beste/json/.github/FUNDING.yml
vendored
Normal file
2
vendor/beste/json/.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
github: jeromegamez
|
||||
tidelift: "packagist/beste/json"
|
||||
15
vendor/beste/json/.github/dependabot.yml
vendored
Normal file
15
vendor/beste/json/.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
commit-message:
|
||||
include: "scope"
|
||||
prefix: "github-actions"
|
||||
open-pull-requests-limit: 10
|
||||
labels:
|
||||
- "dependency"
|
||||
2
vendor/beste/json/.github/settings.yml
vendored
Normal file
2
vendor/beste/json/.github/settings.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# https://probot.github.io/apps/settings/
|
||||
_extends: beste/.github
|
||||
23
vendor/beste/json/.github/workflows/dependabot-auto-merge.yml
vendored
Normal file
23
vendor/beste/json/.github/workflows/dependabot-auto-merge.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
name: "Dependabot auto-merge"
|
||||
|
||||
on: [pull_request_target] # yamllint disable-line rule:truthy
|
||||
|
||||
permissions:
|
||||
contents: "write"
|
||||
|
||||
jobs:
|
||||
dependabot:
|
||||
runs-on: "ubuntu-latest"
|
||||
if: "${{ github.actor == 'dependabot[bot]' }}"
|
||||
steps:
|
||||
- name: "Dependabot metadata"
|
||||
id: "metadata"
|
||||
uses: "dependabot/fetch-metadata@v2.4.0"
|
||||
with:
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
- name: "Enable auto-merge for Dependabot PRs"
|
||||
if: "${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}"
|
||||
run: "gh pr merge --auto --merge \"$PR_URL\""
|
||||
env:
|
||||
PR_URL: "${{github.event.pull_request.html_url}}"
|
||||
GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"
|
||||
80
vendor/beste/json/.github/workflows/tests.yml
vendored
Normal file
80
vendor/beste/json/.github/workflows/tests.yml
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'tests/**'
|
||||
- '.github/workflows/tests.yml'
|
||||
- 'composer.json'
|
||||
push:
|
||||
branches: ['main']
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'tests/**'
|
||||
- '.github/workflows/tests.yml'
|
||||
- 'composer.json'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: PHP ${{ matrix.php }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
php:
|
||||
- "8.1"
|
||||
- "8.2"
|
||||
- "8.3"
|
||||
- "8.4"
|
||||
include:
|
||||
- php: "8.5"
|
||||
composer-options: "--ignore-platform-reqs"
|
||||
dependencies: "highest"
|
||||
|
||||
env:
|
||||
extensions: json
|
||||
key: "cache-${{ matrix.php }}-${{ matrix.dependencies }}-v2" # can be any string, change to clear the extension cache.
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Setup cache environment
|
||||
id: extcache
|
||||
uses: shivammathur/cache-extensions@v1
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
extensions: ${{ env.extensions }}
|
||||
key: ${{ env.key }}
|
||||
|
||||
- name: Cache extensions
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ steps.extcache.outputs.dir }}
|
||||
key: ${{ steps.extcache.outputs.key }}
|
||||
restore-keys: ${{ steps.extcache.outputs.key }}
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
extensions: ${{ env.extensions }}
|
||||
tools: composer, pecl
|
||||
coverage: xdebug
|
||||
env:
|
||||
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- uses: "ramsey/composer-install@v3"
|
||||
|
||||
- name: Setup Problem Matchers
|
||||
run: |
|
||||
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
|
||||
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
|
||||
|
||||
- name: Run PHPStan
|
||||
run: vendor/bin/phpstan
|
||||
|
||||
- name: Run PHPUnit
|
||||
run: vendor/bin/phpunit --testdox --coverage-text
|
||||
44
vendor/beste/json/CHANGELOG.md
vendored
Normal file
44
vendor/beste/json/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# CHANGELOG
|
||||
|
||||
## Unreleased
|
||||
|
||||
## 1.7.0 - 2025-09-12
|
||||
|
||||
* Added support for PHP 8.5
|
||||
|
||||
## 1.6.0 - 2025-04-07
|
||||
|
||||
* Use conditional PHPStan return type to correctly type hint an array when using `JSON::decode()` and
|
||||
`JSON::decodeFile()`
|
||||
|
||||
## 1.5.0 - 2024-12-19
|
||||
|
||||
* Remove requirement that a string must be non-empty
|
||||
|
||||
## 1.5.0 - 2024-08-17
|
||||
|
||||
* Added support for PHP 8.4
|
||||
|
||||
## 1.4.0 - 2023-11-30
|
||||
|
||||
* Restored support for PHP 8.1
|
||||
|
||||
## 1.3.0 - 2023-11-25
|
||||
|
||||
* Added support for PHP 8.3, dropped support for PHP 8.1
|
||||
|
||||
## 1.2.1 - 2022-12-19
|
||||
|
||||
Fixed symlinks not being properly resolved
|
||||
|
||||
## 1.2.0 - 2022-12-01
|
||||
|
||||
Added more checks when decoding JSON Files
|
||||
|
||||
## 1.1.0 - 2022-11-04
|
||||
|
||||
Dropped support for PHP <8.1
|
||||
|
||||
## 1.0.0 - 2022-02-12
|
||||
|
||||
Initial release
|
||||
21
vendor/beste/json/LICENSE
vendored
Normal file
21
vendor/beste/json/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Jérôme Gamez, https://github.com/beste <jerome@gamez.name>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
46
vendor/beste/json/README.md
vendored
Normal file
46
vendor/beste/json/README.md
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
# JSON
|
||||
|
||||
[](https://packagist.org/packages/beste/json)
|
||||
[](https://packagist.org/packages/beste/json)
|
||||
[](https://github.com/beste/json/actions)
|
||||
[](https://discord.gg/Yacm7unBsr)
|
||||
[](https://github.com/sponsors/jeromegamez)
|
||||
|
||||
A simple helper to decode and encode JSON, including from files.
|
||||
|
||||
## Usage
|
||||
|
||||
```php
|
||||
use Beste\Json;
|
||||
use UnexpectedValueException;
|
||||
|
||||
$object = Json::decode('{"key": "value"}');
|
||||
|
||||
$array = Json::decode('{"key": "value"}', $forceArray = true);
|
||||
|
||||
$object = Json::decodeFile('/path/to/file.json');
|
||||
|
||||
$json = Json::encode($object);
|
||||
|
||||
$prettyJson = Json::pretty($object);
|
||||
|
||||
// When something goes wring while decoding/encoding,
|
||||
// an `UnexpectedValueException` is thrown
|
||||
try {
|
||||
Json::decode('{]');
|
||||
} catch (UnexpectedValueException $e) {
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```shell
|
||||
composer require beste/json
|
||||
```
|
||||
|
||||
## Running tests
|
||||
|
||||
```shell
|
||||
composer test
|
||||
```
|
||||
5
vendor/beste/json/SECURITY.md
vendored
Normal file
5
vendor/beste/json/SECURITY.md
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
## Security contact information
|
||||
|
||||
To report a security vulnerability, please use the
|
||||
[Tidelift security contact](https://tidelift.com/security).
|
||||
Tidelift will coordinate the fix and disclosure.
|
||||
52
vendor/beste/json/composer.json
vendored
Normal file
52
vendor/beste/json/composer.json
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "beste/json",
|
||||
"type": "library",
|
||||
"description": "A simple JSON helper to decode and encode JSON",
|
||||
"keywords": ["json", "helper"],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jérôme Gamez",
|
||||
"email": "jerome@gamez.name"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
|
||||
"ext-json": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/extension-installer": "^1.3",
|
||||
"phpstan/phpstan": "^2.0.4",
|
||||
"phpstan/phpstan-phpunit": "^2.0.2",
|
||||
"phpstan/phpstan-strict-rules": "^2.0.1",
|
||||
"phpunit/phpunit": "^10.4.2",
|
||||
"rector/rector": "^2.0.3"
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/Json.php"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Beste\\Json\\Tests\\": "tests"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"phpstan/extension-installer": true
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"analyse": [
|
||||
"XDEBUG_MODE=off vendor/bin/phpstan"
|
||||
],
|
||||
"analyze": "@analyse",
|
||||
"test": [
|
||||
"@analyse",
|
||||
"@test-units"
|
||||
],
|
||||
"test-units": "vendor/bin/phpunit"
|
||||
}
|
||||
}
|
||||
21
vendor/beste/json/phpunit.xml.dist
vendored
Normal file
21
vendor/beste/json/phpunit.xml.dist
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
colors="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Tests">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<coverage ignoreDeprecatedCodeUnits="true"/>
|
||||
|
||||
<source>
|
||||
<include>
|
||||
<directory>src</directory>
|
||||
</include>
|
||||
</source>
|
||||
</phpunit>
|
||||
89
vendor/beste/json/src/Json.php
vendored
Normal file
89
vendor/beste/json/src/Json.php
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Beste;
|
||||
|
||||
use JsonException;
|
||||
use SplFileInfo;
|
||||
use SplFileObject;
|
||||
use Throwable;
|
||||
use UnexpectedValueException;
|
||||
|
||||
final class Json
|
||||
{
|
||||
private const ENCODE_DEFAULT = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
|
||||
private const ENCODE_PRETTY = self::ENCODE_DEFAULT | JSON_PRETTY_PRINT;
|
||||
private const DECODE_DEFAULT = JSON_BIGINT_AS_STRING;
|
||||
|
||||
/**
|
||||
* @throws UnexpectedValueException
|
||||
*
|
||||
* @return ($forceArray is true ? array<mixed> : mixed)
|
||||
*/
|
||||
public static function decode(string $json, ?bool $forceArray = null): mixed
|
||||
{
|
||||
$forceArray ??= false;
|
||||
$flags = $forceArray ? JSON_OBJECT_AS_ARRAY : 0;
|
||||
|
||||
try {
|
||||
return json_decode($json, $forceArray, 512, $flags | self::DECODE_DEFAULT | JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException $e) {
|
||||
throw new UnexpectedValueException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param non-empty-string $path
|
||||
*
|
||||
* @throws UnexpectedValueException
|
||||
*
|
||||
* @return ($forceArray is true ? array<mixed> : mixed)
|
||||
*/
|
||||
public static function decodeFile(string $path, ?bool $forceArray = null): mixed
|
||||
{
|
||||
if (!is_readable($path)) {
|
||||
throw new UnexpectedValueException("The file at '$path' is not readable");
|
||||
}
|
||||
|
||||
if (is_dir($path)) {
|
||||
throw new UnexpectedValueException("'$path' points to a directory");
|
||||
}
|
||||
|
||||
$contents = file_get_contents($path);
|
||||
|
||||
if ($contents === false) {
|
||||
throw new UnexpectedValueException("The file at '$path' is not readable");
|
||||
}
|
||||
|
||||
if ($contents === '') {
|
||||
throw new UnexpectedValueException("The file at '$path' is empty");
|
||||
}
|
||||
|
||||
return self::decode($contents, $forceArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws UnexpectedValueException
|
||||
*/
|
||||
public static function encode(mixed $data, ?int $options = null): string
|
||||
{
|
||||
$options ??= 0;
|
||||
|
||||
try {
|
||||
return json_encode($data, $options | self::ENCODE_DEFAULT | JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException $e) {
|
||||
throw new UnexpectedValueException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws UnexpectedValueException
|
||||
*/
|
||||
public static function pretty(mixed $value, ?int $options = null): string
|
||||
{
|
||||
$options ??= 0;
|
||||
|
||||
return self::encode($value, $options | self::ENCODE_PRETTY);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user