This commit is contained in:
XIGE
2026-02-23 19:48:13 +08:00
parent 3d6d25f535
commit 82a464dca2
351 changed files with 29816 additions and 0 deletions

7
vendor/autoload.php vendored Normal file
View File

@@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit33806c1377e553ceececb4a264f74f6f::getLoader();

479
vendor/composer/ClassLoader.php vendored Normal file

File diff suppressed because it is too large Load Diff

317
vendor/composer/InstalledVersions.php vendored Normal file

File diff suppressed because it is too large Load Diff

21
vendor/composer/LICENSE vendored Normal file
View File

@@ -0,0 +1,21 @@
Copyright (c) Nils Adermann, Jordi Boggiano
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.

11
vendor/composer/autoload_classmap.php vendored Normal file
View File

@@ -0,0 +1,11 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
'Stringable' => $vendorDir . '/myclabs/php-enum/stubs/Stringable.php',
);

11
vendor/composer/autoload_files.php vendored Normal file
View File

@@ -0,0 +1,11 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'841780ea2e1d6545ea3a253239d59c05' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/functions.php',
'5dd19d8a547b7318af0c3a93c8bd6565' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/Http/Middleware/Middleware.php',
);

View File

@@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

11
vendor/composer/autoload_psr4.php vendored Normal file
View File

@@ -0,0 +1,11 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Qiniu\\' => array($vendorDir . '/qiniu/php-sdk/src/Qiniu'),
'MyCLabs\\Enum\\' => array($vendorDir . '/myclabs/php-enum/src'),
);

75
vendor/composer/autoload_real.php vendored Normal file
View File

@@ -0,0 +1,75 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit33806c1377e553ceececb4a264f74f6f
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInit33806c1377e553ceececb4a264f74f6f', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit33806c1377e553ceececb4a264f74f6f', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit33806c1377e553ceececb4a264f74f6f::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit33806c1377e553ceececb4a264f74f6f::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire33806c1377e553ceececb4a264f74f6f($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire33806c1377e553ceececb4a264f74f6f($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}

50
vendor/composer/autoload_static.php vendored Normal file
View File

@@ -0,0 +1,50 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInit33806c1377e553ceececb4a264f74f6f
{
public static $files = array (
'841780ea2e1d6545ea3a253239d59c05' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/functions.php',
'5dd19d8a547b7318af0c3a93c8bd6565' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/Http/Middleware/Middleware.php',
);
public static $prefixLengthsPsr4 = array (
'Q' =>
array (
'Qiniu\\' => 6,
),
'M' =>
array (
'MyCLabs\\Enum\\' => 13,
),
);
public static $prefixDirsPsr4 = array (
'Qiniu\\' =>
array (
0 => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu',
),
'MyCLabs\\Enum\\' =>
array (
0 => __DIR__ . '/..' . '/myclabs/php-enum/src',
),
);
public static $classMap = array (
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'Stringable' => __DIR__ . '/..' . '/myclabs/php-enum/stubs/Stringable.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit33806c1377e553ceececb4a264f74f6f::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit33806c1377e553ceececb4a264f74f6f::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit33806c1377e553ceececb4a264f74f6f::$classMap;
}, null, ClassLoader::class);
}
}

135
vendor/composer/installed.json vendored Normal file
View File

@@ -0,0 +1,135 @@
{
"packages": [
{
"name": "myclabs/php-enum",
"version": "1.8.5",
"version_normalized": "1.8.5.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/php-enum.git",
"reference": "e7be26966b7398204a234f8673fdad5ac6277802"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/php-enum/zipball/e7be26966b7398204a234f8673fdad5ac6277802",
"reference": "e7be26966b7398204a234f8673fdad5ac6277802",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": "^7.3 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "1.*",
"vimeo/psalm": "^4.6.2 || ^5.2"
},
"time": "2025-01-14T11:49:03+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"MyCLabs\\Enum\\": "src/"
},
"classmap": [
"stubs/Stringable.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP Enum contributors",
"homepage": "https://github.com/myclabs/php-enum/graphs/contributors"
}
],
"description": "PHP Enum implementation",
"homepage": "https://github.com/myclabs/php-enum",
"keywords": [
"enum"
],
"support": {
"issues": "https://github.com/myclabs/php-enum/issues",
"source": "https://github.com/myclabs/php-enum/tree/1.8.5"
},
"funding": [
{
"url": "https://github.com/mnapoli",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/myclabs/php-enum",
"type": "tidelift"
}
],
"install-path": "../myclabs/php-enum"
},
{
"name": "qiniu/php-sdk",
"version": "v7.14.0",
"version_normalized": "7.14.0.0",
"source": {
"type": "git",
"url": "https://github.com/qiniu/php-sdk.git",
"reference": "ee752ffa7263ce99fca0bd7340cf13c486a3516c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/qiniu/php-sdk/zipball/ee752ffa7263ce99fca0bd7340cf13c486a3516c",
"reference": "ee752ffa7263ce99fca0bd7340cf13c486a3516c",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-xml": "*",
"myclabs/php-enum": "~1.5.2 || ~1.6.6 || ~1.7.7 || ~1.8.4",
"php": ">=5.3.3"
},
"require-dev": {
"paragonie/random_compat": ">=2",
"phpunit/phpunit": "^4.8 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4",
"squizlabs/php_codesniffer": "^2.3 || ~3.6"
},
"time": "2024-10-25T08:39:01+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"src/Qiniu/functions.php",
"src/Qiniu/Http/Middleware/Middleware.php"
],
"psr-4": {
"Qiniu\\": "src/Qiniu"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Qiniu",
"email": "sdk@qiniu.com",
"homepage": "http://www.qiniu.com"
}
],
"description": "Qiniu Resource (Cloud) Storage SDK for PHP",
"homepage": "http://developer.qiniu.com/",
"keywords": [
"cloud",
"qiniu",
"sdk",
"storage"
],
"support": {
"issues": "https://github.com/qiniu/php-sdk/issues",
"source": "https://github.com/qiniu/php-sdk/tree/v7.14.0"
},
"install-path": "../qiniu/php-sdk"
}
],
"dev": true,
"dev-package-names": []
}

42
vendor/composer/installed.php vendored Normal file
View File

@@ -0,0 +1,42 @@
<?php return array (
'root' =>
array (
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'aliases' =>
array (
),
'reference' => NULL,
'name' => '__root__',
),
'versions' =>
array (
'__root__' =>
array (
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'aliases' =>
array (
),
'reference' => NULL,
),
'myclabs/php-enum' =>
array (
'pretty_version' => '1.8.5',
'version' => '1.8.5.0',
'aliases' =>
array (
),
'reference' => 'e7be26966b7398204a234f8673fdad5ac6277802',
),
'qiniu/php-sdk' =>
array (
'pretty_version' => 'v7.14.0',
'version' => '7.14.0.0',
'aliases' =>
array (
),
'reference' => 'ee752ffa7263ce99fca0bd7340cf13c486a3516c',
),
),
);

26
vendor/composer/platform_check.php vendored Normal file
View File

@@ -0,0 +1,26 @@
<?php
// platform_check.php @generated by Composer
$issues = array();
if (!(PHP_VERSION_ID >= 70300)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.3.0". You are running ' . PHP_VERSION . '.';
}
if ($issues) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
} elseif (!headers_sent()) {
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
}
}
trigger_error(
'Composer detected issues in your platform: ' . implode(' ', $issues),
E_USER_ERROR
);
}

18
vendor/myclabs/php-enum/LICENSE vendored Normal file
View File

@@ -0,0 +1,18 @@
The MIT License (MIT)
Copyright (c) 2015 My C-Labs
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.

196
vendor/myclabs/php-enum/README.md vendored Normal file
View File

@@ -0,0 +1,196 @@
# PHP Enum implementation inspired from SplEnum
[![GitHub Actions][GA Image]][GA Link]
[![Latest Stable Version](https://poser.pugx.org/myclabs/php-enum/version.png)](https://packagist.org/packages/myclabs/php-enum)
[![Total Downloads](https://poser.pugx.org/myclabs/php-enum/downloads.png)](https://packagist.org/packages/myclabs/php-enum)
[![Psalm Shepherd][Shepherd Image]][Shepherd Link]
Maintenance for this project is [supported via Tidelift](https://tidelift.com/subscription/pkg/packagist-myclabs-php-enum?utm_source=packagist-myclabs-php-enum&utm_medium=referral&utm_campaign=readme).
## Why?
First, and mainly, `SplEnum` is not integrated to PHP, you have to install the extension separately.
Using an enum instead of class constants provides the following advantages:
- You can use an enum as a parameter type: `function setAction(Action $action) {`
- You can use an enum as a return type: `function getAction() : Action {`
- You can enrich the enum with methods (e.g. `format`, `parse`, …)
- You can extend the enum to add new values (make your enum `final` to prevent it)
- You can get a list of all the possible values (see below)
This Enum class is not intended to replace class constants, but only to be used when it makes sense.
## Installation
```
composer require myclabs/php-enum
```
## Declaration
```php
use MyCLabs\Enum\Enum;
/**
* Action enum
*
* @extends Enum<Action::*>
*/
final class Action extends Enum
{
private const VIEW = 'view';
private const EDIT = 'edit';
}
```
## Usage
```php
$action = Action::VIEW();
// or with a dynamic key:
$action = Action::$key();
// or with a dynamic value:
$action = Action::from($value);
// or
$action = new Action($value);
```
As you can see, static methods are automatically implemented to provide quick access to an enum value.
One advantage over using class constants is to be able to use an enum as a parameter type:
```php
function setAction(Action $action) {
// ...
}
```
## Documentation
- `__construct()` The constructor checks that the value exist in the enum
- `__toString()` You can `echo $myValue`, it will display the enum value (value of the constant)
- `getValue()` Returns the current value of the enum
- `getKey()` Returns the key of the current value on Enum
- `equals()` Tests whether enum instances are equal (returns `true` if enum values are equal, `false` otherwise)
Static methods:
- `from()` Creates an Enum instance, checking that the value exist in the enum
- `toArray()` method Returns all possible values as an array (constant name in key, constant value in value)
- `keys()` Returns the names (keys) of all constants in the Enum class
- `values()` Returns instances of the Enum class of all Enum constants (constant name in key, Enum instance in value)
- `isValid()` Check if tested value is valid on enum set
- `isValidKey()` Check if tested key is valid on enum set
- `assertValidValue()` Assert the value is valid on enum set, throwing exception otherwise
- `search()` Return key for searched value
### Static methods
```php
final class Action extends Enum
{
private const VIEW = 'view';
private const EDIT = 'edit';
}
// Static method:
$action = Action::VIEW();
$action = Action::EDIT();
```
Static method helpers are implemented using [`__callStatic()`](http://www.php.net/manual/en/language.oop5.overloading.php#object.callstatic).
If you care about IDE autocompletion, you can either implement the static methods yourself:
```php
final class Action extends Enum
{
private const VIEW = 'view';
/**
* @return Action
*/
public static function VIEW() {
return new Action(self::VIEW);
}
}
```
or you can use phpdoc (this is supported in PhpStorm for example):
```php
/**
* @method static Action VIEW()
* @method static Action EDIT()
*/
final class Action extends Enum
{
private const VIEW = 'view';
private const EDIT = 'edit';
}
```
## Native enums and migration
Native enum arrived to PHP in version 8.1: https://www.php.net/enumerations
If your project is running PHP 8.1+ or your library has it as a minimum requirement you should use it instead of this library.
When migrating from `myclabs/php-enum`, the effort should be small if the usage was in the recommended way:
- private constants
- final classes
- no method overridden
Changes for migration:
- Class definition should be changed from
```php
/**
* @method static Action VIEW()
* @method static Action EDIT()
*/
final class Action extends Enum
{
private const VIEW = 'view';
private const EDIT = 'edit';
}
```
to
```php
enum Action: string
{
case VIEW = 'view';
case EDIT = 'edit';
}
```
All places where the class was used as a type will continue to work.
Usages and the change needed:
| Operation | myclabs/php-enum | native enum |
|----------------------------------------------------------------|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Obtain an instance will change from | `$enumCase = Action::VIEW()` | `$enumCase = Action::VIEW` |
| Create an enum from a backed value | `$enumCase = new Action('view')` | `$enumCase = Action::from('view')` |
| Get the backed value of the enum instance | `$enumCase->getValue()` | `$enumCase->value` |
| Compare two enum instances | `$enumCase1 == $enumCase2` <br/> or <br/> `$enumCase1->equals($enumCase2)` | `$enumCase1 === $enumCase2` |
| Get the key/name of the enum instance | `$enumCase->getKey()` | `$enumCase->name` |
| Get a list of all the possible instances of the enum | `Action::values()` | `Action::cases()` |
| Get a map of possible instances of the enum mapped by name | `Action::values()` | `array_combine(array_map(fn($case) => $case->name, Action::cases()), Action::cases())` <br/> or <br/> `(new ReflectionEnum(Action::class))->getConstants()` |
| Get a list of all possible names of the enum | `Action::keys()` | `array_map(fn($case) => $case->name, Action::cases())` |
| Get a list of all possible backed values of the enum | `Action::toArray()` | `array_map(fn($case) => $case->value, Action::cases())` |
| Get a map of possible backed values of the enum mapped by name | `Action::toArray()` | `array_combine(array_map(fn($case) => $case->name, Action::cases()), array_map(fn($case) => $case->value, Action::cases()))` <br/> or <br/> `array_map(fn($case) => $case->value, (new ReflectionEnum(Action::class))->getConstants()))` |
## Related projects
- [PHP 8.1+ native enum](https://www.php.net/enumerations)
- [Doctrine enum mapping](https://github.com/acelaya/doctrine-enum-type)
- [Symfony ParamConverter integration](https://github.com/Ex3v/MyCLabsEnumParamConverter)
- [PHPStan integration](https://github.com/timeweb/phpstan-enum)
[GA Image]: https://github.com/myclabs/php-enum/workflows/CI/badge.svg
[GA Link]: https://github.com/myclabs/php-enum/actions?query=workflow%3A%22CI%22+branch%3Amaster
[Shepherd Image]: https://shepherd.dev/github/myclabs/php-enum/coverage.svg
[Shepherd Link]: https://shepherd.dev/github/myclabs/php-enum

11
vendor/myclabs/php-enum/SECURITY.md vendored Normal file
View File

@@ -0,0 +1,11 @@
# Security Policy
## Supported Versions
Only the latest stable release is supported.
## Reporting a Vulnerability
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
Tidelift will coordinate the fix and disclosure.

36
vendor/myclabs/php-enum/composer.json vendored Normal file
View File

@@ -0,0 +1,36 @@
{
"name": "myclabs/php-enum",
"type": "library",
"description": "PHP Enum implementation",
"keywords": ["enum"],
"homepage": "https://github.com/myclabs/php-enum",
"license": "MIT",
"authors": [
{
"name": "PHP Enum contributors",
"homepage": "https://github.com/myclabs/php-enum/graphs/contributors"
}
],
"autoload": {
"psr-4": {
"MyCLabs\\Enum\\": "src/"
},
"classmap": [
"stubs/Stringable.php"
]
},
"autoload-dev": {
"psr-4": {
"MyCLabs\\Tests\\Enum\\": "tests/"
}
},
"require": {
"php": "^7.3 || ^8.0",
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "1.*",
"vimeo/psalm": "^4.6.2 || ^5.2"
}
}

319
vendor/myclabs/php-enum/src/Enum.php vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,54 @@
<?php
namespace MyCLabs\Enum\PHPUnit;
use MyCLabs\Enum\Enum;
use SebastianBergmann\Comparator\ComparisonFailure;
/**
* Use this Comparator to get nice output when using PHPUnit assertEquals() with Enums.
*
* Add this to your PHPUnit bootstrap PHP file:
*
* \SebastianBergmann\Comparator\Factory::getInstance()->register(new \MyCLabs\Enum\PHPUnit\Comparator());
*/
final class Comparator extends \SebastianBergmann\Comparator\Comparator
{
public function accepts($expected, $actual)
{
return $expected instanceof Enum && (
$actual instanceof Enum || $actual === null
);
}
/**
* @param Enum $expected
* @param Enum|null $actual
*
* @return void
*/
public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = false, $ignoreCase = false)
{
if ($expected->equals($actual)) {
return;
}
throw new ComparisonFailure(
$expected,
$actual,
$this->formatEnum($expected),
$this->formatEnum($actual),
false,
'Failed asserting that two Enums are equal.'
);
}
private function formatEnum(?Enum $enum = null)
{
if ($enum === null) {
return "null";
}
return get_class($enum)."::{$enum->getKey()}()";
}
}

View File

@@ -0,0 +1,11 @@
<?php
if (\PHP_VERSION_ID < 80000 && !interface_exists('Stringable')) {
interface Stringable
{
/**
* @return string
*/
public function __toString();
}
}

View File

@@ -0,0 +1,71 @@
name: PHP CI with Composer
on: [push, pull_request]
jobs:
build:
strategy:
fail-fast: false
matrix:
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup php for mock server
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '1.21.x'
- name: Setup build-in server
run: |
nohup php -S localhost:9000 -t ./tests/mock-server/ > phpd.log 2>&1 &
echo $! > mock-server.pid
cd tests/socks5-server/
nohup go run main.go > ../../socks5.log 2>&1 &
echo $! > ../../socks-server.pid
- name: Setup php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Install dependencies
run: |
composer self-update
composer install --no-interaction --prefer-source --dev
- name: Run cases
run: |
./vendor/bin/phpcs --standard=PSR2 src
./vendor/bin/phpcs --standard=PSR2 examples
./vendor/bin/phpcs --standard=PSR2 tests
./vendor/bin/phpunit --coverage-clover=coverage.xml
cat mock-server.pid | xargs kill
cat socks-server.pid | xargs kill
env:
QINIU_ACCESS_KEY: ${{ secrets.QINIU_ACCESS_KEY }}
QINIU_SECRET_KEY: ${{ secrets.QINIU_SECRET_KEY }}
QINIU_TEST_BUCKET: ${{ secrets.QINIU_TEST_BUCKET }}
QINIU_TEST_DOMAIN: ${{ secrets.QINIU_TEST_DOMAIN }}
- name: Print mock server log
if: ${{ failure() }}
run: |
cat phpd.log
- name: Print socks5 server log
if: ${{ failure() }}
run: |
cat socks5.log
- name: After_success
run: bash <(curl -s https://codecov.io/bash)

View File

@@ -0,0 +1,19 @@
name: PHP SDK Version Check
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
linux:
name: Version Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
- name: Check
run: |
set -e
grep -qF "## ${RELEASE_VERSION}" CHANGELOG.md
grep -qF "const SDK_VER = '${RELEASE_VERSION}';" src/Qiniu/Config.php

12
vendor/qiniu/php-sdk/.gitignore vendored Normal file
View File

@@ -0,0 +1,12 @@
*.phar
*.zip
build/artifacts
phpunit.xml
phpunit.functional.xml
.DS_Store
.swp
.build
composer.lock
vendor
src/package.xml
.idea/

42
vendor/qiniu/php-sdk/.scrutinizer.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
filter:
excluded_paths: [tests/*]
checks:
php:
code_rating: true
remove_extra_empty_lines: true
remove_php_closing_tag: true
remove_trailing_whitespace: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: true
order_alphabetically: true
fix_php_opening_tag: true
fix_linefeed: true
fix_line_ending: true
fix_identation_4spaces: true
fix_doc_comments: true
tools:
external_code_coverage:
timeout: 1200
runs: 3
php_analyzer: true
php_code_coverage: false
php_code_sniffer:
config:
standard: PSR2
filter:
paths: ['src']
php_loc:
enabled: true
excluded_dirs: [vendor, tests]
php_cpd:
enabled: true
excluded_dirs: [vendor, tests]
build:
nodes:
analysis:
tests:
override:
- php-scrutinizer-run

196
vendor/qiniu/php-sdk/CHANGELOG.md vendored Normal file
View File

@@ -0,0 +1,196 @@
# Changelog
## 7.14.0 (2024-10-16)
* 对象存储,持久化处理支持工作流模版
## 7.13.0 (2024-09-05)
* 对象存储,验证回调方法新增支持 Qiniu 签名
* 对象存储,调整查询空间区域域名顺序与默认空间管理域名
* 支持闲时任务配置
## 7.12.1 (2024-02-21)
* 对象存储,添加上传策略部分字段
## 7.12.0 (2023-12-11)
* 对象存储,支持归档直读存储
* 对象存储,批量操作支持自动查询 rs 服务域名
## 7.11.0 (2023-09-05)
* 支持代理
## 7.10.1 (2023-08-04)
* 修复部分 API 调用中间件合并失败(#417
## 7.10.0 (2023-06-20)
* 对象存储,新增请求中间件逻辑,方便拓展请求逻辑
* 对象存储,新增备用 UC 域名用于查询区域域名
* 对象存储,修复分片上传初始化失败无法快速失败
* 对象存储,移除首尔区域
## 7.9.0 (2023-03-31)
* 对象存储,修复无法对 key 为空字符串的对象进行操作
* 修复 301 重定向无法正确获取 header 信息
* 对象存储,新增查询区域域名过期时间
* 对象存储,更新获取区域域名的接口
* 对象存储,更新查询 bucket 域名为 uc 服务
* 对象存储,新增 uc 服务可配置
## 7.8.0 (2022-10-25)
* 移除不推荐域名,并增加区域亚太-首尔和华东-浙江2
* 对象存储,修复断点上传的文件内容不正确
* 对象存储,优化分片上传 ctx 超时检测
## 7.7.0 (2022-09-02)
* 对象存储,新增支持设置文件级别生命周期 setObjectLifecycle API
* 对象存储,内置增加七牛新建存储区域域名信息
* 修复当前已知问题
## 7.6.0 (2022-06-08)
* 对象存储,管理类 API 发送请求时增加 [X-Qiniu-Date](https://developer.qiniu.com/kodo/3924/common-request-headers) (生成请求的时间) header
## 7.5.0 (2022-04-18)
* 对象存储,新增支持 [深度归档存储类型](https://developer.qiniu.com/kodo/3956/kodo-category#deep_archive)
## 7.4.3 (2022-04-01)
* 优化签名算法逻辑
## 7.4.22022-03-01
* 修复已知关于请求 Header 处理不当问题,比如没有处理为大小写不敏感等问题
## 7.4.12021-09-24
* 修复了 分片上传 v2 已知问题,明确给出了参数不合理情况下对应的错误提示信息
## 7.4.0 (2021-07-19)
* 【对象存储】支持 [分片上传 v2](https://developer.qiniu.com/kodo/7458/multipartupload) 和 断点续传,使用方式见 [开发者文档](https://developer.qiniu.com/kodo/1241/php#resume-upload-file)
## 7.3.0 (2020-09-24)
### 新增
* 【对象存储】增加异步抓取方法与demo
* 【融合cdn】增加查询CDN刷新记录、查询CDN预取记录方法与demo
* 【云短信】增加查询短信发送记录的方法
* 【实时音视频】增加rtc停止房间的合流转推方法
* 【内容审核】增加图片审核、视频审核方法与demo
### 修复
* 【对象存储】修复签算 token 时上传策略中的 forceSaveKey 字段不生效的问题
* 【对象存储】修复更新空间事件通知规则方法
### 优化
* 【对象存储】创建空间迁移到mkbucketv3 api
* 优化对 http2 返回头的判断
* 优化 demo 中的文档注释说明
* docs 目录下的 rtc demo 移动至 examples/rtc 目录下
* docs 目录下的 sms demo 移动至 examples/sms 目录下
## 7.2.10 (2019-10-28)
* 去除云短信类类型指定
* 修改不传文件名时存在表单上传错误的情况
## 7.2.9 (2019-07-09)
* 添加空间管理、云短信接口
* 去除无效参数
## 7.2.7 (2018-11-06)
* 添加 QVM 内网上传到 KODO 的 zone 设置
## 7.2.6 (2018-05-18)
* 修复rsrsf在不同机房默认的https域名
## 7.2.5 (2018-05-10)
* 修复表单上传中多余的参数checkCrc导致的fname错位问题
## 7.2.4 (2018-05-09)
### 增加
* 连麦功能
## 7.2.3 (2018-01-20)
### 增加
* 新加坡机房
### 修正
* 获取域名的入口域名
* http回复头部兼容大小写
## 7.2.2 (2017-11-06)
### 增加
* Qiniu算法的鉴权方法
## 7.1.4 (2017-06-21)
### 增加
* cdn 文件/目录 刷新
* cdn 获取 流量/带宽
* cdn 获取域名的访问日志列表
* cdn 对资源链接进行时间戳防盗链签名
## 7.1.3 (2016-11-18)
### 增加
* move, copy操作增加force参数
## 7.1.2 (2016-11-12)
### 修正
* 明确抛出获取各区域域名失败时的报错
## 7.1.1 (2016-11-02)
### 修正
* 多区域配置文件存储目录从home修改到tmp目录
## 7.1.0 (2016-10-22)
### 增加
* 多存储区域的支持
## 7.0.8 (2016-07-19)
### 增加
* demo
* https url 支持
* deleteAfterDays 策略
* 添加图片处理链接统一拼接方法 by @SherlockRen
## 7.0.7 (2016-01-12)
### 修正
* PersistentFop参数pipeline和notify_url失效
* resume 模式 close file inputstream
## 7.0.6 (2015-12-05)
### 修正
* php7.0 Json 对空字符串解析单元测试报错
* 开启安全模式或者设置可操作目录树时设置CURLOPT_FOLLOWLOCATION报错, by @twocabbages
* fetch 支持不指定key, by @sinkcup
## 7.0.5 (2015-10-29)
### 增加
* 增加上传策略最小文件大小限制 fsizeMin
* 增加常见examples
## 7.0.4 (2015-07-23)
### 修正
* 一些地方的严格比较检查
* resumeupload 备用地址失效
## 7.0.3 (2015-07-10)
### 修改
* 多zone 支持
## 7.0.2 (2015-04-18)
### 修改
* fetch 接口返回内容调整
* pfop 接口调整
###修正
* exception 类调用
## 7.0.1 (2015-03-27)
### 增加
* 增加代码注释
## 7.0.0 (2015-02-03)
### 增加
* 简化上传接口
* 自动选择断点续上传还是直传
* 重构代码,接口和内部结构更清晰
* 改变mime
* 代码覆盖度报告
* policy改为array, 便于灵活增加,并加入过期字段检查
* 文件列表支持目录形式
* 利用元编程方式支持 fop 和 pfop

30
vendor/qiniu/php-sdk/CONTRIBUTING.md vendored Normal file
View File

@@ -0,0 +1,30 @@
# 贡献代码指南
我们非常欢迎大家来贡献代码,我们会向贡献者致以最诚挚的敬意。
一般可以通过在Github上提交[Pull Request](https://github.com/qiniu/php-sdk)来贡献代码。
## Pull Request要求
- **[PSR-2 编码风格标准](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** 。要通过项目中的code sniffer检查。
- **代码格式** 提交前 请按 ./vendor/bin/phpcbf --standard=PSR2 进行格式化。
- **必须添加测试!** - 如果没有测试(单元测试、集成测试都可以),那么提交的补丁是不会通过的。
- **记得更新文档** - 保证`README.md`以及其他相关文档及时更新,和代码的变更保持一致性。
- **考虑我们的发布周期** - 我们的版本号会服从[SemVer v2.0.0](http://semver.org/)我们绝对不会随意变更对外的API。
- **创建feature分支** - 最好不要从你的master分支提交 pull request。
- **一个feature提交一个pull请求** - 如果你的代码变更了多个操作那就提交多个pull请求吧。
- **清晰的commit历史** - 保证你的pull请求的每次commit操作都是有意义的。如果你开发中需要执行多次的即时commit操作那么请把它们放到一起再提交pull请求。
## 运行测试
``` bash
./vendor/bin/phpunit tests/Qiniu/Tests/
```

22
vendor/qiniu/php-sdk/LICENSE vendored Normal file
View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014 Qiniu, Ltd.<sdk@qiniu.com>
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.

76
vendor/qiniu/php-sdk/README.md vendored Normal file
View File

@@ -0,0 +1,76 @@
# Qiniu Cloud SDK for PHP
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
[![Build Status](https://travis-ci.org/qiniu/php-sdk.svg)](https://travis-ci.org/qiniu/php-sdk)
[![GitHub release](https://img.shields.io/github/v/tag/qiniu/php-sdk.svg?label=release)](https://github.com/qiniu/php-sdk/releases)
[![Latest Stable Version](https://img.shields.io/packagist/v/qiniu/php-sdk.svg)](https://packagist.org/packages/qiniu/php-sdk)
[![Total Downloads](https://img.shields.io/packagist/dt/qiniu/php-sdk.svg)](https://packagist.org/packages/qiniu/php-sdk)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/qiniu/php-sdk/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/qiniu/php-sdk/?branch=master)
[![Coverage Status](https://codecov.io/gh/qiniu/php-sdk/branch/master/graph/badge.svg)](https://codecov.io/gh/qiniu/php-sdk)
[![Join Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/qiniu/php-sdk?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![@qiniu on weibo](http://img.shields.io/badge/weibo-%40qiniutek-blue.svg)](http://weibo.com/qiniutek)
## 安装
推荐使用 `composer` 进行安装。可以使用 composer.json 声明依赖或者运行下面的命令。SDK 包已经放到这里 [`qiniu/php-sdk`][install-packagist] 。
```bash
$ composer require qiniu/php-sdk
```
## 运行环境
| Qiniu SDK版本 | PHP 版本 |
|:--------------------:|:-----------------------------------------------:|
| 7.x | cURL extension, 5.3 - 5.6, 7.0 - 7.4, 8.0-8.1 |
| 6.x | cURL extension, 5.2 - 5.6 |
## 使用方法
### 上传
```php
use Qiniu\Storage\UploadManager;
use Qiniu\Auth;
...
$uploadMgr = new UploadManager();
$auth = new Auth($accessKey, $secretKey);
$token = $auth->uploadToken($bucket);
list($ret, $error) = $uploadMgr->putFile($token, 'key', 'filePath');
...
```
## 测试
``` bash
$ ./vendor/bin/phpunit tests/Qiniu/Tests/
```
## 常见问题
- `$error` 保留了请求响应的信息,失败情况下 `ret` 为 `none`, 将 `$error` 可以打印出来,提交给我们。
- API 的使用 demo 可以参考 [examples](https://github.com/qiniu/php-sdk/tree/master/examples)。
## 代码贡献
详情参考[代码提交指南](https://github.com/qiniu/php-sdk/blob/master/CONTRIBUTING.md)。
## 贡献记录
- [所有贡献者](https://github.com/qiniu/php-sdk/contributors)
## 联系我们
- 如果需要帮助请提交工单在portal右侧点击咨询和建议提交工单或者直接向 support@qiniu.com 发送邮件)
- 如果有什么问题,可以到问答社区提问,[问答社区](https://qiniu.segmentfault.com/)
- 更详细的文档,见[官方文档站](https://developer.qiniu.com/)
- 如果发现了 bug 欢迎提交 [issue](https://github.com/qiniu/php-sdk/issues)
- 如果有功能需求,欢迎提交 [issue](https://github.com/qiniu/php-sdk/issues)
- 如果要提交代码,欢迎提交 pull request
- 欢迎关注我们的[微信](https://www.qiniu.com/#weixin) [微博](https://weibo.com/qiniutek),及时获取动态信息。
## 代码许可
The MIT License (MIT).详情见 [License文件](https://github.com/qiniu/php-sdk/blob/master/LICENSE).
[packagist]: http://packagist.org
[install-packagist]: https://packagist.org/packages/qiniu/php-sdk

19
vendor/qiniu/php-sdk/autoload.php vendored Normal file
View File

@@ -0,0 +1,19 @@
<?php
if ( file_exists(dirname(__FILE__).'/vendor/autoload.php') ) {
require_once dirname(__FILE__).'/vendor/autoload.php';
}
function classLoader($class)
{
$path = str_replace('\\', DIRECTORY_SEPARATOR, $class);
$file = __DIR__ . '/src/' . $path . '.php';
if (file_exists($file)) {
require_once $file;
}
}
spl_autoload_register('classLoader');
require_once __DIR__ . '/src/Qiniu/functions.php';
require_once __DIR__ . '/src/Qiniu/Http/Middleware/Middleware.php';

28
vendor/qiniu/php-sdk/codecov.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
codecov:
ci:
- prow.qiniu.io # prow 里面运行需添加,其他 CI 不要
require_ci_to_pass: no # 改为 no否则 codecov 会等待其他 GitHub 上所有 CI 通过才会留言。
github_checks: #关闭github checks
annotations: false
comment:
layout: "reach, diff, flags, files"
behavior: new # 默认是更新旧留言,改为 new删除旧的增加新的。
require_changes: false # if true: only post the comment if coverage changes
require_base: no # [yes :: must have a base report to post]
require_head: yes # [yes :: must have a head report to post]
branches: # branch names that can post comment
- "master"
coverage:
status: # 评判 pr 通过的标准
patch: off
project: # project 统计所有代码x
default:
# basic
target: 85% # 总体通过标准
threshold: 3% # 允许单次下降的幅度
base: auto
if_not_found: success
if_ci_failed: error

Some files were not shown because too many files have changed in this diff Show More