wesmiler 2 lat temu
rodzic
commit
64966e28ec
30 zmienionych plików z 2523 dodań i 0 usunięć
  1. 11 0
      vendor/yansongda/supports/.gitattributes
  2. 45 0
      vendor/yansongda/supports/.github/workflows/style.yml
  3. 29 0
      vendor/yansongda/supports/.github/workflows/tester.yml
  4. 4 0
      vendor/yansongda/supports/.gitignore
  5. 23 0
      vendor/yansongda/supports/.php-cs-fixer.php
  6. 10 0
      vendor/yansongda/supports/CHANGELOG.md
  7. 20 0
      vendor/yansongda/supports/LICENSE
  8. 72 0
      vendor/yansongda/supports/README.md
  9. 47 0
      vendor/yansongda/supports/composer.json
  10. 7 0
      vendor/yansongda/supports/phpstan.neon
  11. 19 0
      vendor/yansongda/supports/phpunit.xml
  12. 489 0
      vendor/yansongda/supports/src/Arr.php
  13. 327 0
      vendor/yansongda/supports/src/Collection.php
  14. 7 0
      vendor/yansongda/supports/src/Config.php
  15. 57 0
      vendor/yansongda/supports/src/Functions.php
  16. 115 0
      vendor/yansongda/supports/src/Pipeline.php
  17. 460 0
      vendor/yansongda/supports/src/Str.php
  18. 73 0
      vendor/yansongda/supports/src/Traits/Accessable.php
  19. 25 0
      vendor/yansongda/supports/src/Traits/Arrayable.php
  20. 58 0
      vendor/yansongda/supports/src/Traits/Serializable.php
  21. 107 0
      vendor/yansongda/supports/tests/ArrTest.php
  22. 102 0
      vendor/yansongda/supports/tests/CollectionTest.php
  23. 17 0
      vendor/yansongda/supports/tests/ConfigTest.php
  24. 18 0
      vendor/yansongda/supports/tests/FunctionTest.php
  25. 239 0
      vendor/yansongda/supports/tests/PipelineTest.php
  26. 33 0
      vendor/yansongda/supports/tests/StrTest.php
  27. 19 0
      vendor/yansongda/supports/tests/Stubs/FooPipeline.php
  28. 31 0
      vendor/yansongda/supports/tests/Stubs/TraitStub.php
  29. 29 0
      vendor/yansongda/supports/tests/Traits/ArrayAccessTest.php
  30. 30 0
      vendor/yansongda/supports/tests/Traits/SerializableTest.php

+ 11 - 0
vendor/yansongda/supports/.gitattributes

@@ -0,0 +1,11 @@
+* text=auto
+
+/tests export-ignore
+/.github export-ignore
+
+.gitattributes export-ignore
+.gitignore export-ignore
+phpunit.php export-ignore
+phpunit.xml export-ignore
+phpunit.xml.dist export-ignore
+.php_cs  export-ignore

+ 45 - 0
vendor/yansongda/supports/.github/workflows/style.yml

@@ -0,0 +1,45 @@
+name: Coding Style
+on:
+  push:
+    branches:
+      - master
+  pull_request:
+
+jobs:
+  php_cs_fixer:
+    name: php_cs_fixer
+    runs-on: "ubuntu-latest"
+    steps:
+      - name: Checkout Code
+        uses: actions/checkout@v4
+      - name: PHP
+        uses: shivammathur/setup-php@v2
+        with:
+          php-version: '8.3'
+          coverage: none
+      - name: Install Dependencies
+        run: composer install --no-progress
+      - name: Run PHP-CS-Fixer
+        run: composer cs-fix
+  php_stan:
+    name: php_stan-php${{ matrix.php-version }}
+    runs-on: "ubuntu-latest"
+    strategy:
+      fail-fast: true
+      matrix:
+        php-version:
+          - 8.1
+          - 8.2
+          - 8.3
+    steps:
+      -   name: Checkout Code
+          uses: actions/checkout@v4
+      -   name: PHP
+          uses: shivammathur/setup-php@v2
+          with:
+            php-version: ${{ matrix.php-version }}
+            coverage: none
+      -   name: Install Dependencies
+          run: composer install --no-progress
+      -   name: Run PHP-Stan
+          run: composer analyse

+ 29 - 0
vendor/yansongda/supports/.github/workflows/tester.yml

@@ -0,0 +1,29 @@
+name: Tester
+on:
+  push:
+    branches:
+      - master
+  pull_request:
+
+jobs:
+  PHPUnit:
+    name: phpunit-php${{ matrix.php-version }}
+    runs-on: "ubuntu-latest"
+    strategy:
+      fail-fast: true
+      matrix:
+        php-version:
+          - 8.1
+          - 8.2
+          - 8.3
+    steps:
+      - name: Checkout Code
+        uses: actions/checkout@v4
+      - name: PHP
+        uses: shivammathur/setup-php@v2
+        with:
+          php-version: ${{ matrix.php-version }}
+      - name: Install Dependencies
+        run: composer install --no-progress
+      - name: Run PHPUnit
+        run: composer test

+ 4 - 0
vendor/yansongda/supports/.gitignore

@@ -0,0 +1,4 @@
+vendor/
+*.log
+composer.lock
+.DS_Store

+ 23 - 0
vendor/yansongda/supports/.php-cs-fixer.php

@@ -0,0 +1,23 @@
+<?php
+
+$finder = PhpCsFixer\Finder::create()
+    ->exclude('tests')
+    ->exclude('vendor')
+    ->in(__DIR__);
+
+return (new PhpCsFixer\Config())
+    ->setUsingCache(false)
+    ->setRiskyAllowed(true)
+    ->setRules([
+        '@PhpCsFixer' => true,
+        'declare_strict_types' => true,
+        'single_line_comment_style' => ['comment_types' => ['hash']],
+        'general_phpdoc_annotation_remove' => ['annotations' => ['author'], 'case_sensitive' => false],
+        'global_namespace_import' => [
+            'import_classes' => true,
+            'import_constants' => true,
+            'import_functions' => true,
+        ],
+        'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
+    ])
+    ->setFinder($finder);

+ 10 - 0
vendor/yansongda/supports/CHANGELOG.md

@@ -0,0 +1,10 @@
+# v4.0.0
+
+## change
+
+- php 最低版本改为 8.0
+
+## delete
+
+- 删除 Yansongda\Supports\Logger\StdoutHandler
+- 删除 Yansongda\Supports\Logger

+ 20 - 0
vendor/yansongda/supports/LICENSE

@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2017 yansongda <me@yansongda.cn>
+
+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.

+ 72 - 0
vendor/yansongda/supports/README.md

@@ -0,0 +1,72 @@
+<h1 align="center">Supports</h1>
+
+[![Linter Status](https://github.com/yansongda/supports/workflows/Linter/badge.svg)](https://github.com/yansongda/supports/actions) 
+[![Tester Status](https://github.com/yansongda/supports/workflows/Tester/badge.svg)](https://github.com/yansongda/supports/actions) 
+[![Latest Stable Version](https://poser.pugx.org/yansongda/supports/v/stable)](https://packagist.org/packages/yansongda/supports)
+[![Total Downloads](https://poser.pugx.org/yansongda/supports/downloads)](https://packagist.org/packages/yansongda/supports)
+[![Latest Unstable Version](https://poser.pugx.org/yansongda/supports/v/unstable)](https://packagist.org/packages/yansongda/supports)
+[![License](https://poser.pugx.org/yansongda/supports/license)](https://packagist.org/packages/yansongda/supports)
+
+
+handle with array/config/log/guzzle etc.
+
+## About log
+
+```PHP
+use Yansongda\Supports\Logger as Log;
+use Monolog\Logger;
+
+class ApplicationLogger
+{
+    private static $logger;
+
+    /**
+     * Forward call.
+     *
+     * @author yansongda <me@yansongda.cn>
+     *
+     * @return mixed
+     */
+    public static function __callStatic(string $method, array $args)
+    {
+        return call_user_func_array([self::getLogger(), $method], $args);
+    }
+
+    /**
+     * Forward call.
+     *
+     * @author yansongda <me@yansongda.cn>
+     *
+     * @return mixed
+     */
+    public function __call(string $method, array $args)
+    {
+        return call_user_func_array([self::getLogger(), $method], $args);
+    }
+
+    /**
+     * Make a default log instance.
+     *
+     * @author yansongda <me@yansongda.cn>
+     *
+     * @return Log
+     */
+    public static function getLogger()
+    {
+        if (! self::$logger instanceof Logger) {
+            self::$logger = new Log();
+        }   
+
+        return self::$logger;
+    }
+}
+```
+
+### Usage
+
+After registerLog, you can use Log service:
+
+```PHP
+
+ApplicationLogger::debug('test', ['test log']);
+```

+ 47 - 0
vendor/yansongda/supports/composer.json

@@ -0,0 +1,47 @@
+{
+    "name": "yansongda/supports",
+    "description": "common components",
+    "keywords": ["support", "array", "collection", "config"],
+    "support": {
+        "issues": "https://github.com/yansongda/supports/issues",
+        "source": "https://github.com/yansongda/supports"
+    },
+    "authors": [
+        {
+            "name": "yansongda",
+            "email": "me@yansongda.cn"
+        }
+    ],
+    "require": {
+        "php": ">=8.0"
+    },
+    "require-dev": {
+        "phpunit/phpunit": "^9.0",
+        "mockery/mockery": "^1.4",
+        "friendsofphp/php-cs-fixer": "^3.0",
+        "phpstan/phpstan": "^1.1.0"
+    },
+    "autoload": {
+        "files": [
+            "src/Functions.php"
+        ],
+        "psr-4": {
+            "Yansongda\\Supports\\": "src/"
+        }
+    },
+    "autoload-dev": {
+        "psr-4": {
+            "Yansongda\\Supports\\Tests\\": "tests/"
+        }
+    },
+    "suggest": {
+        "symfony/console": "Use stdout logger",
+        "monolog/monolog": "Use logger"
+    },
+    "scripts": {
+        "test": "./vendor/bin/phpunit -c phpunit.xml --colors=always",
+        "cs-fix": "php-cs-fixer fix --dry-run --diff 1>&2",
+        "analyse": "phpstan analyse --memory-limit 300M -l 5 -c phpstan.neon ./src"
+    },
+    "license": "MIT"
+}

+ 7 - 0
vendor/yansongda/supports/phpstan.neon

@@ -0,0 +1,7 @@
+parameters:
+    reportUnmatchedIgnoredErrors: false
+    ignoreErrors:
+        -
+            message: '#Unsafe usage of new static\(\)#'
+            paths:
+                - src/Collection.php

+ 19 - 0
vendor/yansongda/supports/phpunit.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
+         backupGlobals="false"
+         backupStaticAttributes="false"
+         bootstrap="./vendor/autoload.php"
+         colors="true"
+         convertErrorsToExceptions="true"
+         convertNoticesToExceptions="true"
+         convertWarningsToExceptions="true"
+         processIsolation="false"
+         stopOnFailure="false"
+         cacheResult="false">
+    <testsuites>
+        <testsuite name="Tests">
+            <directory suffix="Test.php">./tests</directory>
+        </testsuite>
+    </testsuites>
+</phpunit>

+ 489 - 0
vendor/yansongda/supports/src/Arr.php

@@ -0,0 +1,489 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Yansongda\Supports;
+
+use ArrayAccess;
+use InvalidArgumentException;
+
+/**
+ * Most of the methods in this file come from illuminate/support and hyperf/support,
+ * thanks provide such a useful class.
+ */
+class Arr
+{
+    public static function accessible(mixed $value): bool
+    {
+        return is_array($value) || $value instanceof ArrayAccess;
+    }
+
+    public static function add(array $array, string $key, mixed $value): array
+    {
+        if (is_null(static::get($array, $key))) {
+            static::set($array, $key, $value);
+        }
+
+        return $array;
+    }
+
+    public static function collapse(array $array): array
+    {
+        $results = [];
+        foreach ($array as $values) {
+            if ($values instanceof Collection) {
+                $values = $values->all();
+            } elseif (!is_array($values)) {
+                continue;
+            }
+            $results[] = $values;
+        }
+
+        return array_merge([], ...$results);
+    }
+
+    public static function crossJoin(...$arrays): array
+    {
+        $results = [[]];
+        foreach ($arrays as $index => $array) {
+            $append = [];
+            foreach ($results as $product) {
+                foreach ($array as $item) {
+                    $product[$index] = $item;
+                    $append[] = $product;
+                }
+            }
+            $results = $append;
+        }
+
+        return $results;
+    }
+
+    public static function divide(array $array): array
+    {
+        return [array_keys($array), array_values($array)];
+    }
+
+    public static function dot(array $array, string $prepend = ''): array
+    {
+        $results = [];
+        foreach ($array as $key => $value) {
+            if (is_array($value) && !empty($value)) {
+                $results = array_merge($results, static::dot($value, $prepend.$key.'.'));
+            } else {
+                $results[$prepend.$key] = $value;
+            }
+        }
+
+        return $results;
+    }
+
+    public static function except(array $array, array|string $keys): array
+    {
+        static::forget($array, $keys);
+
+        return $array;
+    }
+
+    public static function exists(array|ArrayAccess $array, int|string $key): bool
+    {
+        if ($array instanceof ArrayAccess) {
+            return $array->offsetExists($key);
+        }
+
+        return array_key_exists($key, $array);
+    }
+
+    public static function first(array $array, callable $callback = null, mixed $default = null): mixed
+    {
+        if (is_null($callback)) {
+            if (empty($array)) {
+                return $default;
+            }
+            foreach ($array as $item) {
+                return $item;
+            }
+        }
+        foreach ($array as $key => $value) {
+            if (call_user_func($callback, $value, $key)) {
+                return $value;
+            }
+        }
+
+        return $default;
+    }
+
+    public static function last(array $array, callable $callback = null, mixed $default = null): mixed
+    {
+        if (is_null($callback)) {
+            return empty($array) ? $default : end($array);
+        }
+
+        return static::first(array_reverse($array, true), $callback, $default);
+    }
+
+    public static function flatten(array $array, float|int $depth = INF): array
+    {
+        $result = [];
+        foreach ($array as $item) {
+            $item = $item instanceof Collection ? $item->all() : $item;
+            if (!is_array($item)) {
+                $result[] = $item;
+            } elseif (1 === $depth) {
+                $result = array_merge($result, array_values($item));
+            } else {
+                $result = array_merge($result, static::flatten($item, $depth - 1));
+            }
+        }
+
+        return $result;
+    }
+
+    public static function forget(array &$array, array|string $keys): void
+    {
+        $original = &$array;
+        $keys = (array) $keys;
+        if (0 === count($keys)) {
+            return;
+        }
+        foreach ($keys as $key) {
+            // if the exact key exists in the top-level, remove it
+            if (static::exists($array, $key)) {
+                unset($array[$key]);
+
+                continue;
+            }
+            $parts = explode('.', $key);
+            // clean up before each pass
+            $array = &$original;
+            while (count($parts) > 1) {
+                $part = array_shift($parts);
+                if (isset($array[$part]) && is_array($array[$part])) {
+                    $array = &$array[$part];
+                } else {
+                    continue 2;
+                }
+            }
+            unset($array[array_shift($parts)]);
+        }
+    }
+
+    public static function get(array|ArrayAccess $array, int|string $key = null, mixed $default = null): mixed
+    {
+        if (!static::accessible($array)) {
+            return $default;
+        }
+        if (is_null($key)) {
+            return $array;
+        }
+        if (static::exists($array, $key)) {
+            return $array[$key];
+        }
+        if (!is_string($key) || !str_contains($key, '.')) {
+            return $array[$key] ?? $default;
+        }
+        foreach (explode('.', $key) as $segment) {
+            if (static::accessible($array) && static::exists($array, $segment)) {
+                $array = $array[$segment];
+            } else {
+                return $default;
+            }
+        }
+
+        return $array;
+    }
+
+    public static function has(array|ArrayAccess $array, null|array|string $keys): bool
+    {
+        if (is_null($keys)) {
+            return false;
+        }
+        $keys = (array) $keys;
+        if (!$array) {
+            return false;
+        }
+        if ([] === $keys) {
+            return false;
+        }
+        foreach ($keys as $key) {
+            $subKeyArray = $array;
+            if (static::exists($array, $key)) {
+                continue;
+            }
+            foreach (explode('.', $key) as $segment) {
+                if (static::accessible($subKeyArray) && static::exists($subKeyArray, $segment)) {
+                    $subKeyArray = $subKeyArray[$segment];
+                } else {
+                    return false;
+                }
+            }
+        }
+
+        return true;
+    }
+
+    public static function isAssoc(array $array): bool
+    {
+        $keys = array_keys($array);
+
+        return array_keys($keys) !== $keys;
+    }
+
+    public static function only(array $array, array|string $keys): array
+    {
+        return array_intersect_key($array, array_flip((array) $keys));
+    }
+
+    public static function pluck(array $array, array|string $value, null|array|string $key = null): array
+    {
+        $results = [];
+
+        foreach ($array as $item) {
+            $itemValue = data_get($item, $value);
+            // If the key is "null", we will just append the value to the array and keep
+            // looping, Otherwise we will key the array using the value of the key we
+            // received from the developer. Then we'll return the final array form.
+            if (is_null($key)) {
+                $results[] = $itemValue;
+            } else {
+                $itemKey = data_get($item, $key);
+                if (is_object($itemKey) && method_exists($itemKey, '__toString')) {
+                    $itemKey = (string) $itemKey;
+                }
+                $results[$itemKey] = $itemValue;
+            }
+        }
+
+        return $results;
+    }
+
+    public static function prepend(array $array, mixed $value, mixed $key = null): array
+    {
+        if (is_null($key)) {
+            array_unshift($array, $value);
+        } else {
+            $array = [$key => $value] + $array;
+        }
+
+        return $array;
+    }
+
+    public static function pull(array &$array, string $key, mixed $default = null): mixed
+    {
+        $value = static::get($array, $key, $default);
+        static::forget($array, $key);
+
+        return $value;
+    }
+
+    /**
+     * @throws InvalidArgumentException
+     */
+    public static function random(array $array, int $number = 1): array
+    {
+        $count = count($array);
+        if ($number > $count) {
+            throw new InvalidArgumentException("You requested {$number} items, but there are only {$count} items available.");
+        }
+
+        if (0 === $number) {
+            return [];
+        }
+
+        $keys = array_rand($array, $number);
+        $results = [];
+        foreach ((array) $keys as $key) {
+            $results[] = $array[$key];
+        }
+
+        return $results;
+    }
+
+    /**
+     * Set an array item to a given value using "dot" notation.
+     * If no key is given to the method, the entire array will be replaced.
+     */
+    public static function set(array &$array, null|int|string $key, mixed $value): array
+    {
+        if (is_null($key)) {
+            return $array = $value;
+        }
+        if (!is_string($key)) {
+            $array[$key] = $value;
+
+            return $array;
+        }
+        $keys = explode('.', $key);
+        while (count($keys) > 1) {
+            $key = array_shift($keys);
+            // If the key doesn't exist at this depth, we will just create an empty array
+            // to hold the next value, allowing us to create the arrays to hold final
+            // values at the correct depth. Then we'll keep digging into the array.
+            if (!isset($array[$key]) || !is_array($array[$key])) {
+                $array[$key] = [];
+            }
+            $array = &$array[$key];
+        }
+        $array[array_shift($keys)] = $value;
+
+        return $array;
+    }
+
+    public static function shuffle(array $array, int $seed = null): array
+    {
+        if (is_null($seed)) {
+            shuffle($array);
+        } else {
+            srand($seed);
+            usort($array, function () {
+                return rand(-1, 1);
+            });
+        }
+
+        return $array;
+    }
+
+    public static function sort(array $array, callable $callback): array
+    {
+        $results = [];
+
+        foreach ($array as $key => $value) {
+            $results[$key] = $callback($value);
+        }
+
+        return $results;
+    }
+
+    public static function sortRecursive(array $array): array
+    {
+        foreach ($array as &$value) {
+            if (is_array($value)) {
+                $value = static::sortRecursive($value);
+            }
+        }
+        if (static::isAssoc($array)) {
+            ksort($array);
+        } else {
+            sort($array);
+        }
+
+        return $array;
+    }
+
+    public static function query(array $array, int $encodingType = PHP_QUERY_RFC1738): string
+    {
+        return http_build_query($array, '', '&', $encodingType);
+    }
+
+    public static function toString(array $array, string $separator = '&'): string
+    {
+        $result = '';
+
+        foreach ($array as $key => $value) {
+            $result .= $key.'='.$value.$separator;
+        }
+
+        return substr($result, 0, 0 - Str::length($separator));
+    }
+
+    public static function where(array $array, callable $callback): array
+    {
+        return array_filter($array, $callback, ARRAY_FILTER_USE_BOTH);
+    }
+
+    public static function wrap(mixed $value): array
+    {
+        if (is_null($value)) {
+            return [];
+        }
+
+        return !is_array($value) ? [$value] : $value;
+    }
+
+    public static function unique(array $array): array
+    {
+        $result = [];
+        foreach ($array as $key => $item) {
+            if (is_array($item)) {
+                $result[$key] = self::unique($item);
+            } else {
+                $result[$key] = $item;
+            }
+        }
+
+        if (!self::isAssoc($result)) {
+            return array_unique($result);
+        }
+
+        return $result;
+    }
+
+    public static function merge(array $array1, array $array2, bool $unique = true): array
+    {
+        $isAssoc = static::isAssoc($array1 ?: $array2);
+        if ($isAssoc) {
+            foreach ($array2 as $key => $value) {
+                if (is_array($value)) {
+                    $array1[$key] = static::merge($array1[$key] ?? [], $value, $unique);
+                } else {
+                    $array1[$key] = $value;
+                }
+            }
+        } else {
+            foreach ($array2 as $value) {
+                if ($unique && in_array($value, $array1, true)) {
+                    continue;
+                }
+                $array1[] = $value;
+            }
+
+            $array1 = array_values($array1);
+        }
+
+        return $array1;
+    }
+
+    public static function encoding(array $array, string $to_encoding, string $from_encoding = 'gb2312'): array
+    {
+        $encoded = [];
+
+        foreach ($array as $key => $value) {
+            $encoded[$key] = is_array($value) ? self::encoding($value, $to_encoding, $from_encoding) :
+                                                mb_convert_encoding($value, $to_encoding, $from_encoding);
+        }
+
+        return $encoded;
+    }
+
+    public static function camelCaseKey(mixed $data): mixed
+    {
+        if (!self::accessible($data)
+            && !(is_object($data) && method_exists($data, 'toArray'))) {
+            return $data;
+        }
+
+        $result = [];
+
+        foreach ((is_object($data) ? $data->toArray() : $data) as $key => $value) {
+            $result[is_string($key) ? Str::camel($key) : $key] = self::camelCaseKey($value);
+        }
+
+        return $result;
+    }
+
+    public static function snakeCaseKey(mixed $data): mixed
+    {
+        if (!self::accessible($data)
+            && !(is_object($data) && method_exists($data, 'toArray'))) {
+            return $data;
+        }
+
+        $result = [];
+
+        foreach ((is_object($data) ? $data->toArray() : $data) as $key => $value) {
+            $result[is_string($key) ? Str::snake($key) : $key] = self::snakeCaseKey($value);
+        }
+
+        return $result;
+    }
+}

+ 327 - 0
vendor/yansongda/supports/src/Collection.php

@@ -0,0 +1,327 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Yansongda\Supports;
+
+use ArrayAccess;
+use ArrayIterator;
+use Countable;
+use InvalidArgumentException;
+use IteratorAggregate;
+use JsonSerializable;
+use Traversable;
+use Yansongda\Supports\Traits\Accessable;
+use Yansongda\Supports\Traits\Arrayable;
+use Yansongda\Supports\Traits\Serializable;
+
+class Collection implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable
+{
+    use Serializable;
+    use Accessable;
+    use Arrayable;
+
+    protected array $items = [];
+
+    public function __construct(mixed $items = [])
+    {
+        foreach ($this->getArrayableItems($items) as $key => $value) {
+            $this->set($key, $value);
+        }
+    }
+
+    public static function wrap(mixed $value): self
+    {
+        return $value instanceof self ? new static($value) : new static(Arr::wrap($value));
+    }
+
+    public static function unwrap(array|Collection $value): array
+    {
+        return $value instanceof self ? $value->all() : $value;
+    }
+
+    public function all(): array
+    {
+        return $this->items;
+    }
+
+    public function only(array $keys): array
+    {
+        $return = [];
+
+        foreach ($keys as $key) {
+            $value = $this->get($key);
+
+            if (!is_null($value)) {
+                $return[$key] = $value;
+            }
+        }
+
+        return $return;
+    }
+
+    public function except(mixed $keys): self
+    {
+        $keys = is_array($keys) ? $keys : func_get_args();
+
+        return new static(Arr::except($this->items, $keys));
+    }
+
+    public function filter(callable $callback = null): self
+    {
+        if ($callback) {
+            return new static(Arr::where($this->items, $callback));
+        }
+
+        return new static(array_filter($this->items));
+    }
+
+    public function merge(mixed $items): self
+    {
+        return new static(array_merge($this->items, $this->getArrayableItems($items)));
+    }
+
+    public function has(int|string $key): bool
+    {
+        return !is_null(Arr::get($this->items, $key));
+    }
+
+    public function first(): mixed
+    {
+        return reset($this->items);
+    }
+
+    public function last(): mixed
+    {
+        $end = end($this->items);
+
+        reset($this->items);
+
+        return $end;
+    }
+
+    public function add(null|int|string $key, mixed $value): void
+    {
+        Arr::set($this->items, $key, $value);
+    }
+
+    public function set(null|int|string $key, mixed $value): void
+    {
+        Arr::set($this->items, $key, $value);
+    }
+
+    public function get(null|int|string $key = null, mixed $default = null): mixed
+    {
+        return Arr::get($this->items, $key, $default);
+    }
+
+    public function forget(int|string $key): void
+    {
+        Arr::forget($this->items, $key);
+    }
+
+    public function flatten(float|int $depth = INF): self
+    {
+        return new static(Arr::flatten($this->items, $depth));
+    }
+
+    public function map(callable $callback): self
+    {
+        $keys = array_keys($this->items);
+        $items = array_map($callback, $this->items, $keys);
+
+        return new static(array_combine($keys, $items));
+    }
+
+    public function pop(): mixed
+    {
+        return array_pop($this->items);
+    }
+
+    public function prepend(mixed $value, mixed $key = null): self
+    {
+        $this->items = Arr::prepend($this->items, $value, $key);
+
+        return $this;
+    }
+
+    public function push(mixed $value): self
+    {
+        $this->offsetSet(null, $value);
+
+        return $this;
+    }
+
+    public function pull(mixed $key, mixed $default = null): mixed
+    {
+        return Arr::pull($this->items, $key, $default);
+    }
+
+    public function put(mixed $key, mixed $value): self
+    {
+        $this->offsetSet($key, $value);
+
+        return $this;
+    }
+
+    /**
+     * @throws InvalidArgumentException
+     */
+    public function random(?int $number = null): self
+    {
+        return new static(Arr::random($this->items, $number ?? 1));
+    }
+
+    public function reduce(callable $callback, mixed $initial = null): mixed
+    {
+        return array_reduce($this->items, $callback, $initial);
+    }
+
+    public function values(): self
+    {
+        return new static(array_values($this->items));
+    }
+
+    public function every(callable|string $key): bool
+    {
+        $callback = $this->valueRetriever($key);
+
+        foreach ($this->items as $k => $v) {
+            if (!$callback($v, $k)) {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    public function chunk(int $size): self
+    {
+        if ($size <= 0) {
+            return new static();
+        }
+        $chunks = [];
+        foreach (array_chunk($this->items, $size, true) as $chunk) {
+            $chunks[] = new static($chunk);
+        }
+
+        return new static($chunks);
+    }
+
+    public function sort(callable $callback = null): self
+    {
+        $items = $this->items;
+        $callback ? uasort($items, $callback) : asort($items);
+
+        return new static($items);
+    }
+
+    public function sortBy(callable|string $callback, int $options = SORT_REGULAR, bool $descending = false): self
+    {
+        $results = [];
+        $callback = $this->valueRetriever($callback);
+        // First we will loop through the items and get the comparator from a callback
+        // function which we were given. Then, we will sort the returned values
+        // and grab the corresponding values for the sorted keys from this array.
+        foreach ($this->items as $key => $value) {
+            $results[$key] = $callback($value, $key);
+        }
+        $descending ? arsort($results, $options) : asort($results, $options);
+        // Once we have sorted all the keys in the array, we will loop through them
+        // and grab the corresponding model, so we can set the underlying items list
+        // to the sorted version. Then we'll just return the collection instance.
+        foreach (array_keys($results) as $key) {
+            $results[$key] = $this->items[$key];
+        }
+
+        return new static($results);
+    }
+
+    public function sortByDesc(callable|string $callback, int $options = SORT_REGULAR): self
+    {
+        return $this->sortBy($callback, $options, true);
+    }
+
+    public function sortKeys(int $options = SORT_REGULAR, bool $descending = false): self
+    {
+        $items = $this->items;
+        $descending ? krsort($items, $options) : ksort($items, $options);
+
+        return new static($items);
+    }
+
+    public function sortKeysDesc(int $options = SORT_REGULAR): self
+    {
+        return $this->sortKeys($options, true);
+    }
+
+    public function query(int $encodingType = PHP_QUERY_RFC1738): string
+    {
+        return Arr::query($this->all(), $encodingType);
+    }
+
+    public function toString(string $separator = '&'): string
+    {
+        return Arr::toString($this->all(), $separator);
+    }
+
+    public function toArray(): array
+    {
+        return $this->all();
+    }
+
+    public function toJson(int $option = JSON_UNESCAPED_UNICODE): string
+    {
+        return json_encode($this->all(), $option);
+    }
+
+    public function getIterator(): Traversable
+    {
+        return new ArrayIterator($this->items);
+    }
+
+    public function count(): int
+    {
+        return count($this->items);
+    }
+
+    public function offsetUnset(mixed $offset): void
+    {
+        if ($this->offsetExists($offset)) {
+            $this->forget($offset);
+        }
+    }
+
+    protected function useAsCallable(mixed $value): bool
+    {
+        return !is_string($value) && is_callable($value);
+    }
+
+    protected function valueRetriever(mixed $value): callable
+    {
+        if ($this->useAsCallable($value)) {
+            return $value;
+        }
+
+        return function ($item) use ($value) {
+            return data_get($item, $value);
+        };
+    }
+
+    protected function getArrayableItems(mixed $items): array
+    {
+        if (is_array($items)) {
+            return $items;
+        }
+
+        if ($items instanceof self) {
+            return $items->all();
+        }
+
+        if ($items instanceof JsonSerializable) {
+            return $items->jsonSerialize();
+        }
+
+        return (array) $items;
+    }
+}

+ 7 - 0
vendor/yansongda/supports/src/Config.php

@@ -0,0 +1,7 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Yansongda\Supports;
+
+class Config extends Collection {}

+ 57 - 0
vendor/yansongda/supports/src/Functions.php

@@ -0,0 +1,57 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Yansongda\Supports;
+
+use Closure;
+
+if (!function_exists('collect')) {
+    function collect(array $value = []): Collection
+    {
+        return new Collection($value);
+    }
+}
+
+if (!function_exists('value')) {
+    function value(mixed $value): mixed
+    {
+        return $value instanceof Closure ? $value() : $value;
+    }
+}
+
+if (!function_exists('data_get')) {
+    function data_get(mixed $target, null|array|int|string $key, mixed $default = null): mixed
+    {
+        if (is_null($key)) {
+            return $target;
+        }
+
+        $key = is_array($key) ? $key : explode('.', is_int($key) ? (string) $key : $key);
+
+        while (!is_null($segment = array_shift($key))) {
+            if ('*' === $segment) {
+                if ($target instanceof Collection) {
+                    $target = $target->all();
+                } elseif (!is_array($target)) {
+                    return value($default);
+                }
+                $result = [];
+                foreach ($target as $item) {
+                    $result[] = data_get($item, $key);
+                }
+
+                return in_array('*', $key) ? Arr::collapse($result) : $result;
+            }
+            if (Arr::accessible($target) && Arr::exists($target, $segment)) {
+                $target = $target[$segment];
+            } elseif (is_object($target) && isset($target->{$segment})) {
+                $target = $target->{$segment};
+            } else {
+                return value($default);
+            }
+        }
+
+        return $target;
+    }
+}

+ 115 - 0
vendor/yansongda/supports/src/Pipeline.php

@@ -0,0 +1,115 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Yansongda\Supports;
+
+use Closure;
+use Psr\Container\ContainerInterface;
+
+/**
+ * This file mostly code come from illuminate/pipe and hyperf/utils,
+ * thanks provide such a useful class.
+ */
+class Pipeline
+{
+    protected ContainerInterface $container;
+
+    protected mixed $passable;
+
+    protected array $pipes = [];
+
+    protected string $method = 'handle';
+
+    public function __construct(ContainerInterface $container)
+    {
+        $this->container = $container;
+    }
+
+    public function send(mixed $passable): self
+    {
+        $this->passable = $passable;
+
+        return $this;
+    }
+
+    public function through(mixed $pipes): self
+    {
+        $this->pipes = is_array($pipes) ? $pipes : func_get_args();
+
+        return $this;
+    }
+
+    /**
+     * Set the method to call on the pipes.
+     */
+    public function via(string $method): self
+    {
+        $this->method = $method;
+
+        return $this;
+    }
+
+    public function then(Closure $destination): mixed
+    {
+        $pipeline = array_reduce(array_reverse($this->pipes), $this->carry(), $this->prepareDestination($destination));
+
+        return $pipeline($this->passable);
+    }
+
+    protected function prepareDestination(Closure $destination): Closure
+    {
+        return static function ($passable) use ($destination) {
+            return $destination($passable);
+        };
+    }
+
+    protected function carry(): Closure
+    {
+        return function ($stack, $pipe) {
+            return function ($passable) use ($stack, $pipe) {
+                if (is_callable($pipe)) {
+                    // If the pipe is an instance of a Closure, we will just call it directly, but
+                    // otherwise we'll resolve the pipes out of the container and call it with
+                    // the appropriate method and arguments, returning the results back out.
+                    return $pipe($passable, $stack);
+                }
+                if (!is_object($pipe)) {
+                    [$name, $parameters] = $this->parsePipeString($pipe);
+
+                    // If the pipe is a string we will parse the string and resolve the class out
+                    // of the dependency injection container. We can then build a callable and
+                    // execute the pipe function giving in the parameters that are required.
+                    $pipe = $this->container->get($name);
+
+                    $parameters = array_merge([$passable, $stack], $parameters);
+                } else {
+                    // If the pipe is already an object we'll just make a callable and pass it to
+                    // the pipe as-is. There is no need to do any extra parsing and formatting
+                    // since the object we're given was already a fully instantiated object.
+                    $parameters = [$passable, $stack];
+                }
+
+                $carry = method_exists($pipe, $this->method) ? $pipe->{$this->method}(...$parameters) : $pipe(...$parameters);
+
+                return $this->handleCarry($carry);
+            };
+        };
+    }
+
+    protected function parsePipeString(string $pipe): array
+    {
+        [$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []);
+
+        if (is_string($parameters)) {
+            $parameters = explode(',', $parameters);
+        }
+
+        return [$name, $parameters];
+    }
+
+    protected function handleCarry(mixed $carry): mixed
+    {
+        return $carry;
+    }
+}

+ 460 - 0
vendor/yansongda/supports/src/Str.php

@@ -0,0 +1,460 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Yansongda\Supports;
+
+use Random\RandomException;
+
+/**
+ * Most of the methods in this file come from illuminate/support.
+ * thanks provide such a useful class.
+ */
+class Str
+{
+    public static function after(string $subject, string $search): string
+    {
+        return '' === $search ? $subject : array_reverse(explode($search, $subject, 2))[0];
+    }
+
+    public static function ascii(string $value, string $language = 'en'): string
+    {
+        $languageSpecific = static::languageSpecificCharsArray($language);
+
+        if (!is_null($languageSpecific)) {
+            $value = str_replace($languageSpecific[0], $languageSpecific[1], $value);
+        }
+
+        foreach (static::charsArray() as $key => $val) {
+            $value = str_replace($val, $key, $value);
+        }
+
+        return preg_replace('/[^\x20-\x7E]/u', '', $value);
+    }
+
+    public static function before(string $subject, string $search): string
+    {
+        return '' === $search ? $subject : explode($search, $subject)[0];
+    }
+
+    public static function camel(string $value): string
+    {
+        return lcfirst(static::studly($value));
+    }
+
+    public static function contains(string $haystack, array|string $needles): bool
+    {
+        foreach ((array) $needles as $needle) {
+            if (str_contains($haystack, $needle)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    public static function endsWith(string $haystack, array|string $needles): bool
+    {
+        foreach ((array) $needles as $needle) {
+            if (str_ends_with($haystack, $needle)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    public static function finish(string $value, string $cap): string
+    {
+        $quoted = preg_quote($cap, '/');
+
+        return preg_replace('/(?:'.$quoted.')+$/u', '', $value).$cap;
+    }
+
+    public static function is(array|string $pattern, string $value): bool
+    {
+        $patterns = Arr::wrap($pattern);
+
+        if (empty($patterns)) {
+            return false;
+        }
+
+        foreach ($patterns as $pattern) {
+            // If the given value is an exact match we can of course return true right
+            // from the beginning. Otherwise, we will translate asterisks and do an
+            // actual pattern match against the two strings to see if they match.
+            if ($pattern == $value) {
+                return true;
+            }
+
+            $pattern = preg_quote($pattern, '#');
+
+            // Asterisks are translated into zero-or-more regular expression wildcards
+            // to make it convenient to check if the strings starts with the given
+            // pattern such as "library/*", making any string check convenient.
+            $pattern = str_replace('\*', '.*', $pattern);
+
+            if (1 === preg_match('#^'.$pattern.'\z#u', $value)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    public static function kebab(string $value): string
+    {
+        return static::snake($value, '-');
+    }
+
+    public static function length(string $value, ?string $encoding = null): int
+    {
+        if (null !== $encoding) {
+            return mb_strlen($value, $encoding);
+        }
+
+        return mb_strlen($value);
+    }
+
+    public static function limit(string $value, int $limit = 100, string $end = '...'): string
+    {
+        if (mb_strwidth($value, 'UTF-8') <= $limit) {
+            return $value;
+        }
+
+        return rtrim(mb_strimwidth($value, 0, $limit, '', 'UTF-8')).$end;
+    }
+
+    public static function lower(string $value): string
+    {
+        return mb_strtolower($value, 'UTF-8');
+    }
+
+    public static function words(string $value, int $words = 100, string $end = '...'): string
+    {
+        preg_match('/^\s*+\S++\s*+{1,'.$words.'}/u', $value, $matches);
+
+        if (!isset($matches[0]) || static::length($value) === static::length($matches[0])) {
+            return $value;
+        }
+
+        return rtrim($matches[0]).$end;
+    }
+
+    public static function parseCallback(string $callback, ?string $default = null): array
+    {
+        return static::contains($callback, '@') ? explode('@', $callback, 2) : [$callback, $default];
+    }
+
+    /**
+     * @throws RandomException
+     */
+    public static function random(int $length = 16): string
+    {
+        $string = '';
+
+        while (($len = strlen($string)) < $length) {
+            $size = $length - $len;
+
+            $bytes = random_bytes($size);
+
+            $string .= substr(str_replace(['/', '+', '='], '', base64_encode($bytes)), 0, $size);
+        }
+
+        return $string;
+    }
+
+    public static function uuidV4(): string
+    {
+        return sprintf(
+            '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
+            // 32 bits for "time_low"
+            mt_rand(0, 0xFFFF),
+            mt_rand(0, 0xFFFF),
+
+            // 16 bits for "time_mid"
+            mt_rand(0, 0xFFFF),
+
+            // 16 bits for "time_hi_and_version",
+            // four most significant bits holds version number 4
+            mt_rand(0, 0x0FFF) | 0x4000,
+
+            // 16 bits, 8 bits for "clk_seq_hi_res",
+            // 8 bits for "clk_seq_low",
+            // two most significant bits holds zero and one for variant DCE1.1
+            mt_rand(0, 0x3FFF) | 0x8000,
+
+            // 48 bits for "node"
+            mt_rand(0, 0xFFFF),
+            mt_rand(0, 0xFFFF),
+            mt_rand(0, 0xFFFF)
+        );
+    }
+
+    public static function replaceArray(string $search, array $replace, string $subject): string
+    {
+        foreach ($replace as $value) {
+            $subject = static::replaceFirst($search, $value, $subject);
+        }
+
+        return $subject;
+    }
+
+    public static function replaceFirst(string $search, string $replace, string $subject): string
+    {
+        if ('' == $search) {
+            return $subject;
+        }
+
+        $position = strpos($subject, $search);
+
+        if (false !== $position) {
+            return substr_replace($subject, $replace, $position, strlen($search));
+        }
+
+        return $subject;
+    }
+
+    public static function replaceLast(string $search, string $replace, string $subject): string
+    {
+        $position = strrpos($subject, $search);
+
+        if (false !== $position) {
+            return substr_replace($subject, $replace, $position, strlen($search));
+        }
+
+        return $subject;
+    }
+
+    public static function start(string $value, string $prefix): string
+    {
+        $quoted = preg_quote($prefix, '/');
+
+        return $prefix.preg_replace('/^(?:'.$quoted.')+/u', '', $value);
+    }
+
+    public static function upper(string $value): string
+    {
+        return mb_strtoupper($value, 'UTF-8');
+    }
+
+    public static function title(string $value): string
+    {
+        return mb_convert_case($value, MB_CASE_TITLE, 'UTF-8');
+    }
+
+    public static function slug(string $title, string $separator = '-', string $language = 'en'): string
+    {
+        $title = static::ascii($title, $language);
+
+        // Convert all dashes/underscores into separator
+        $flip = '-' == $separator ? '_' : '-';
+
+        $title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title);
+
+        // Replace @ with the word 'at'
+        $title = str_replace('@', $separator.'at'.$separator, $title);
+
+        // Remove all characters that are not the separator, letters, numbers, or whitespace.
+        $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', mb_strtolower($title));
+
+        // Replace all separator characters and whitespace by a single separator
+        $title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title);
+
+        return trim($title, $separator);
+    }
+
+    public static function snake(string $value, string $delimiter = '_'): string
+    {
+        if (!ctype_lower($value)) {
+            $value = preg_replace('/\s+/u', '', ucwords($value));
+
+            $value = static::lower(preg_replace('/(.)(?=[A-Z])/u', '$1'.$delimiter, $value));
+        }
+
+        return $value;
+    }
+
+    public static function startsWith(string $haystack, array|string $needles): bool
+    {
+        foreach ((array) $needles as $needle) {
+            if (str_starts_with($haystack, $needle)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    public static function studly(string $value, string $gap = ''): string
+    {
+        $value = ucwords(str_replace(['-', '_'], ' ', $value));
+
+        return str_replace(' ', $gap, $value);
+    }
+
+    public static function substr(string $string, int $start, ?int $length = null): string
+    {
+        return mb_substr($string, $start, $length, 'UTF-8');
+    }
+
+    public static function ucfirst(string $string): string
+    {
+        return static::upper(static::substr($string, 0, 1)).static::substr($string, 1);
+    }
+
+    public static function encoding(string $string, string $to = 'utf-8', string $from = 'gb2312'): string
+    {
+        return mb_convert_encoding($string, $to, $from);
+    }
+
+    /**
+     * @see https://github.com/danielstjules/Stringy/blob/3.1.0/LICENSE.txt
+     */
+    protected static function charsArray(): array
+    {
+        static $charsArray;
+
+        if (isset($charsArray)) {
+            return $charsArray;
+        }
+
+        return $charsArray = [
+            '0' => ['°', '₀', '۰', '0'],
+            '1' => ['¹', '₁', '۱', '1'],
+            '2' => ['²', '₂', '۲', '2'],
+            '3' => ['³', '₃', '۳', '3'],
+            '4' => ['⁴', '₄', '۴', '٤', '4'],
+            '5' => ['⁵', '₅', '۵', '٥', '5'],
+            '6' => ['⁶', '₆', '۶', '٦', '6'],
+            '7' => ['⁷', '₇', '۷', '7'],
+            '8' => ['⁸', '₈', '۸', '8'],
+            '9' => ['⁹', '₉', '۹', '9'],
+            'a' => ['à', 'á', 'ả', 'ã', 'ạ', 'ă', 'ắ', 'ằ', 'ẳ', 'ẵ', 'ặ', 'â', 'ấ', 'ầ', 'ẩ', 'ẫ', 'ậ', 'ā', 'ą', 'å', 'α', 'ά', 'ἀ', 'ἁ', 'ἂ', 'ἃ', 'ἄ', 'ἅ', 'ἆ', 'ἇ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ὰ', 'ά', 'ᾰ', 'ᾱ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'а', 'أ', 'အ', 'ာ', 'ါ', 'ǻ', 'ǎ', 'ª', 'ა', 'अ', 'ا', 'a', 'ä'],
+            'b' => ['б', 'β', 'ب', 'ဗ', 'ბ', 'b'],
+            'c' => ['ç', 'ć', 'č', 'ĉ', 'ċ', 'c'],
+            'd' => ['ď', 'ð', 'đ', 'ƌ', 'ȡ', 'ɖ', 'ɗ', 'ᵭ', 'ᶁ', 'ᶑ', 'д', 'δ', 'د', 'ض', 'ဍ', 'ဒ', 'დ', 'd'],
+            'e' => ['é', 'è', 'ẻ', 'ẽ', 'ẹ', 'ê', 'ế', 'ề', 'ể', 'ễ', 'ệ', 'ë', 'ē', 'ę', 'ě', 'ĕ', 'ė', 'ε', 'έ', 'ἐ', 'ἑ', 'ἒ', 'ἓ', 'ἔ', 'ἕ', 'ὲ', 'έ', 'е', 'ё', 'э', 'є', 'ə', 'ဧ', 'ေ', 'ဲ', 'ე', 'ए', 'إ', 'ئ', 'e'],
+            'f' => ['ф', 'φ', 'ف', 'ƒ', 'ფ', 'f'],
+            'g' => ['ĝ', 'ğ', 'ġ', 'ģ', 'г', 'ґ', 'γ', 'ဂ', 'გ', 'گ', 'g'],
+            'h' => ['ĥ', 'ħ', 'η', 'ή', 'ح', 'ه', 'ဟ', 'ှ', 'ჰ', 'h'],
+            'i' => ['í', 'ì', 'ỉ', 'ĩ', 'ị', 'î', 'ï', 'ī', 'ĭ', 'į', 'ı', 'ι', 'ί', 'ϊ', 'ΐ', 'ἰ', 'ἱ', 'ἲ', 'ἳ', 'ἴ', 'ἵ', 'ἶ', 'ἷ', 'ὶ', 'ί', 'ῐ', 'ῑ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'і', 'ї', 'и', 'ဣ', 'ိ', 'ီ', 'ည်', 'ǐ', 'ი', 'इ', 'ی', 'i'],
+            'j' => ['ĵ', 'ј', 'Ј', 'ჯ', 'ج', 'j'],
+            'k' => ['ķ', 'ĸ', 'к', 'κ', 'Ķ', 'ق', 'ك', 'က', 'კ', 'ქ', 'ک', 'k'],
+            'l' => ['ł', 'ľ', 'ĺ', 'ļ', 'ŀ', 'л', 'λ', 'ل', 'လ', 'ლ', 'l'],
+            'm' => ['м', 'μ', 'م', 'မ', 'მ', 'm'],
+            'n' => ['ñ', 'ń', 'ň', 'ņ', 'ʼn', 'ŋ', 'ν', 'н', 'ن', 'န', 'ნ', 'n'],
+            'o' => ['ó', 'ò', 'ỏ', 'õ', 'ọ', 'ô', 'ố', 'ồ', 'ổ', 'ỗ', 'ộ', 'ơ', 'ớ', 'ờ', 'ở', 'ỡ', 'ợ', 'ø', 'ō', 'ő', 'ŏ', 'ο', 'ὀ', 'ὁ', 'ὂ', 'ὃ', 'ὄ', 'ὅ', 'ὸ', 'ό', 'о', 'و', 'θ', 'ို', 'ǒ', 'ǿ', 'º', 'ო', 'ओ', 'o', 'ö'],
+            'p' => ['п', 'π', 'ပ', 'პ', 'پ', 'p'],
+            'q' => ['ყ', 'q'],
+            'r' => ['ŕ', 'ř', 'ŗ', 'р', 'ρ', 'ر', 'რ', 'r'],
+            's' => ['ś', 'š', 'ş', 'с', 'σ', 'ș', 'ς', 'س', 'ص', 'စ', 'ſ', 'ს', 's'],
+            't' => ['ť', 'ţ', 'т', 'τ', 'ț', 'ت', 'ط', 'ဋ', 'တ', 'ŧ', 'თ', 'ტ', 't'],
+            'u' => ['ú', 'ù', 'ủ', 'ũ', 'ụ', 'ư', 'ứ', 'ừ', 'ử', 'ữ', 'ự', 'û', 'ū', 'ů', 'ű', 'ŭ', 'ų', 'µ', 'у', 'ဉ', 'ု', 'ူ', 'ǔ', 'ǖ', 'ǘ', 'ǚ', 'ǜ', 'უ', 'उ', 'u', 'ў', 'ü'],
+            'v' => ['в', 'ვ', 'ϐ', 'v'],
+            'w' => ['ŵ', 'ω', 'ώ', 'ဝ', 'ွ', 'w'],
+            'x' => ['χ', 'ξ', 'x'],
+            'y' => ['ý', 'ỳ', 'ỷ', 'ỹ', 'ỵ', 'ÿ', 'ŷ', 'й', 'ы', 'υ', 'ϋ', 'ύ', 'ΰ', 'ي', 'ယ', 'y'],
+            'z' => ['ź', 'ž', 'ż', 'з', 'ζ', 'ز', 'ဇ', 'ზ', 'z'],
+            'aa' => ['ع', 'आ', 'آ'],
+            'ae' => ['æ', 'ǽ'],
+            'ai' => ['ऐ'],
+            'ch' => ['ч', 'ჩ', 'ჭ', 'چ'],
+            'dj' => ['ђ', 'đ'],
+            'dz' => ['џ', 'ძ'],
+            'ei' => ['ऍ'],
+            'gh' => ['غ', 'ღ'],
+            'ii' => ['ई'],
+            'ij' => ['ij'],
+            'kh' => ['х', 'خ', 'ხ'],
+            'lj' => ['љ'],
+            'nj' => ['њ'],
+            'oe' => ['ö', 'œ', 'ؤ'],
+            'oi' => ['ऑ'],
+            'oii' => ['ऒ'],
+            'ps' => ['ψ'],
+            'sh' => ['ш', 'შ', 'ش'],
+            'shch' => ['щ'],
+            'ss' => ['ß'],
+            'sx' => ['ŝ'],
+            'th' => ['þ', 'ϑ', 'ث', 'ذ', 'ظ'],
+            'ts' => ['ц', 'ც', 'წ'],
+            'ue' => ['ü'],
+            'uu' => ['ऊ'],
+            'ya' => ['я'],
+            'yu' => ['ю'],
+            'zh' => ['ж', 'ჟ', 'ژ'],
+            '(c)' => ['©'],
+            'A' => ['Á', 'À', 'Ả', 'Ã', 'Ạ', 'Ă', 'Ắ', 'Ằ', 'Ẳ', 'Ẵ', 'Ặ', 'Â', 'Ấ', 'Ầ', 'Ẩ', 'Ẫ', 'Ậ', 'Å', 'Ā', 'Ą', 'Α', 'Ά', 'Ἀ', 'Ἁ', 'Ἂ', 'Ἃ', 'Ἄ', 'Ἅ', 'Ἆ', 'Ἇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'Ᾰ', 'Ᾱ', 'Ὰ', 'Ά', 'ᾼ', 'А', 'Ǻ', 'Ǎ', 'A', 'Ä'],
+            'B' => ['Б', 'Β', 'ब', 'B'],
+            'C' => ['Ç', 'Ć', 'Č', 'Ĉ', 'Ċ', 'C'],
+            'D' => ['Ď', 'Ð', 'Đ', 'Ɖ', 'Ɗ', 'Ƌ', 'ᴅ', 'ᴆ', 'Д', 'Δ', 'D'],
+            'E' => ['É', 'È', 'Ẻ', 'Ẽ', 'Ẹ', 'Ê', 'Ế', 'Ề', 'Ể', 'Ễ', 'Ệ', 'Ë', 'Ē', 'Ę', 'Ě', 'Ĕ', 'Ė', 'Ε', 'Έ', 'Ἐ', 'Ἑ', 'Ἒ', 'Ἓ', 'Ἔ', 'Ἕ', 'Έ', 'Ὲ', 'Е', 'Ё', 'Э', 'Є', 'Ə', 'E'],
+            'F' => ['Ф', 'Φ', 'F'],
+            'G' => ['Ğ', 'Ġ', 'Ģ', 'Г', 'Ґ', 'Γ', 'G'],
+            'H' => ['Η', 'Ή', 'Ħ', 'H'],
+            'I' => ['Í', 'Ì', 'Ỉ', 'Ĩ', 'Ị', 'Î', 'Ï', 'Ī', 'Ĭ', 'Į', 'İ', 'Ι', 'Ί', 'Ϊ', 'Ἰ', 'Ἱ', 'Ἳ', 'Ἴ', 'Ἵ', 'Ἶ', 'Ἷ', 'Ῐ', 'Ῑ', 'Ὶ', 'Ί', 'И', 'І', 'Ї', 'Ǐ', 'ϒ', 'I'],
+            'J' => ['J'],
+            'K' => ['К', 'Κ', 'K'],
+            'L' => ['Ĺ', 'Ł', 'Л', 'Λ', 'Ļ', 'Ľ', 'Ŀ', 'ल', 'L'],
+            'M' => ['М', 'Μ', 'M'],
+            'N' => ['Ń', 'Ñ', 'Ň', 'Ņ', 'Ŋ', 'Н', 'Ν', 'N'],
+            'O' => ['Ó', 'Ò', 'Ỏ', 'Õ', 'Ọ', 'Ô', 'Ố', 'Ồ', 'Ổ', 'Ỗ', 'Ộ', 'Ơ', 'Ớ', 'Ờ', 'Ở', 'Ỡ', 'Ợ', 'Ø', 'Ō', 'Ő', 'Ŏ', 'Ο', 'Ό', 'Ὀ', 'Ὁ', 'Ὂ', 'Ὃ', 'Ὄ', 'Ὅ', 'Ὸ', 'Ό', 'О', 'Θ', 'Ө', 'Ǒ', 'Ǿ', 'O', 'Ö'],
+            'P' => ['П', 'Π', 'P'],
+            'Q' => ['Q'],
+            'R' => ['Ř', 'Ŕ', 'Р', 'Ρ', 'Ŗ', 'R'],
+            'S' => ['Ş', 'Ŝ', 'Ș', 'Š', 'Ś', 'С', 'Σ', 'S'],
+            'T' => ['Ť', 'Ţ', 'Ŧ', 'Ț', 'Т', 'Τ', 'T'],
+            'U' => ['Ú', 'Ù', 'Ủ', 'Ũ', 'Ụ', 'Ư', 'Ứ', 'Ừ', 'Ử', 'Ữ', 'Ự', 'Û', 'Ū', 'Ů', 'Ű', 'Ŭ', 'Ų', 'У', 'Ǔ', 'Ǖ', 'Ǘ', 'Ǚ', 'Ǜ', 'U', 'Ў', 'Ü'],
+            'V' => ['В', 'V'],
+            'W' => ['Ω', 'Ώ', 'Ŵ', 'W'],
+            'X' => ['Χ', 'Ξ', 'X'],
+            'Y' => ['Ý', 'Ỳ', 'Ỷ', 'Ỹ', 'Ỵ', 'Ÿ', 'Ῠ', 'Ῡ', 'Ὺ', 'Ύ', 'Ы', 'Й', 'Υ', 'Ϋ', 'Ŷ', 'Y'],
+            'Z' => ['Ź', 'Ž', 'Ż', 'З', 'Ζ', 'Z'],
+            'AE' => ['Æ', 'Ǽ'],
+            'Ch' => ['Ч'],
+            'Dj' => ['Ђ'],
+            'Dz' => ['Џ'],
+            'Gx' => ['Ĝ'],
+            'Hx' => ['Ĥ'],
+            'Ij' => ['IJ'],
+            'Jx' => ['Ĵ'],
+            'Kh' => ['Х'],
+            'Lj' => ['Љ'],
+            'Nj' => ['Њ'],
+            'Oe' => ['Œ'],
+            'Ps' => ['Ψ'],
+            'Sh' => ['Ш'],
+            'Shch' => ['Щ'],
+            'Ss' => ['ẞ'],
+            'Th' => ['Þ'],
+            'Ts' => ['Ц'],
+            'Ya' => ['Я'],
+            'Yu' => ['Ю'],
+            'Zh' => ['Ж'],
+            ' ' => ["\xC2\xA0", "\xE2\x80\x80", "\xE2\x80\x81", "\xE2\x80\x82", "\xE2\x80\x83", "\xE2\x80\x84", "\xE2\x80\x85", "\xE2\x80\x86", "\xE2\x80\x87", "\xE2\x80\x88", "\xE2\x80\x89", "\xE2\x80\x8A", "\xE2\x80\xAF", "\xE2\x81\x9F", "\xE3\x80\x80", "\xEF\xBE\xA0"],
+        ];
+    }
+
+    /**
+     * @see https://github.com/danielstjules/Stringy/blob/3.1.0/LICENSE.txt
+     */
+    protected static function languageSpecificCharsArray(string $language): ?array
+    {
+        static $languageSpecific;
+        if (!isset($languageSpecific)) {
+            $languageSpecific = [
+                'bg' => [
+                    ['х', 'Х', 'щ', 'Щ', 'ъ', 'Ъ', 'ь', 'Ь'],
+                    ['h', 'H', 'sht', 'SHT', 'a', 'А', 'y', 'Y'],
+                ],
+                'de' => [
+                    ['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü'],
+                    ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'],
+                ],
+            ];
+        }
+
+        return $languageSpecific[$language] ?? null;
+    }
+}

+ 73 - 0
vendor/yansongda/supports/src/Traits/Accessable.php

@@ -0,0 +1,73 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Yansongda\Supports\Traits;
+
+use Yansongda\Supports\Str;
+
+trait Accessable
+{
+    public function __get(string $key): mixed
+    {
+        return $this->get($key);
+    }
+
+    public function __isset(string $key): bool
+    {
+        return !is_null($this->get($key));
+    }
+
+    public function __unset(string $key): void
+    {
+        $this->offsetUnset($key);
+    }
+
+    public function __set(string $key, mixed $value): void
+    {
+        $this->set($key, $value);
+    }
+
+    public function get(?string $key = null, mixed $default = null): mixed
+    {
+        if (is_null($key)) {
+            return method_exists($this, 'toArray') ? $this->toArray() : $default;
+        }
+
+        $method = 'get'.Str::studly($key);
+
+        if (method_exists($this, $method)) {
+            return $this->{$method}();
+        }
+
+        return $default;
+    }
+
+    public function set(string $key, mixed $value): self
+    {
+        $method = 'set'.Str::studly($key);
+
+        if (method_exists($this, $method)) {
+            $this->{$method}($value);
+        }
+
+        return $this;
+    }
+
+    public function offsetExists(mixed $offset): bool
+    {
+        return !is_null($this->get($offset));
+    }
+
+    public function offsetGet(mixed $offset): mixed
+    {
+        return $this->get($offset);
+    }
+
+    public function offsetSet(mixed $offset, mixed $value): void
+    {
+        $this->set($offset, $value);
+    }
+
+    public function offsetUnset(mixed $offset): void {}
+}

+ 25 - 0
vendor/yansongda/supports/src/Traits/Arrayable.php

@@ -0,0 +1,25 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Yansongda\Supports\Traits;
+
+use ReflectionClass;
+use Yansongda\Supports\Str;
+
+trait Arrayable
+{
+    public function toArray(): array
+    {
+        $result = [];
+
+        foreach ((new ReflectionClass($this))->getProperties() as $item) {
+            $k = $item->getName();
+            $method = 'get'.Str::studly($k);
+
+            $result[Str::snake($k)] = method_exists($this, $method) ? $this->{$method}() : $this->{$k};
+        }
+
+        return $result;
+    }
+}

+ 58 - 0
vendor/yansongda/supports/src/Traits/Serializable.php

@@ -0,0 +1,58 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Yansongda\Supports\Traits;
+
+trait Serializable
+{
+    public function __serialize(): array
+    {
+        if (method_exists($this, 'toArray')) {
+            return $this->toArray();
+        }
+
+        return [];
+    }
+
+    public function __unserialize(array $data): void
+    {
+        $this->unserializeArray($data);
+    }
+
+    public function __toString(): string
+    {
+        return $this->toJson();
+    }
+
+    public function serialize(): ?string
+    {
+        return serialize($this);
+    }
+
+    public function unserialize(string $data): void
+    {
+        unserialize($data);
+    }
+
+    public function toJson(int $option = JSON_UNESCAPED_UNICODE): string
+    {
+        return json_encode($this->__serialize(), $option);
+    }
+
+    public function jsonSerialize(): array
+    {
+        return $this->__serialize();
+    }
+
+    public function unserializeArray(array $data): self
+    {
+        foreach ($data as $key => $item) {
+            if (method_exists($this, 'set')) {
+                $this->set($key, $item);
+            }
+        }
+
+        return $this;
+    }
+}

+ 107 - 0
vendor/yansongda/supports/tests/ArrTest.php

@@ -0,0 +1,107 @@
+<?php
+
+namespace Yansongda\Supports\Tests;
+
+use PHPUnit\Framework\TestCase;
+use stdClass;
+use Yansongda\Supports\Arr;
+
+class ArrTest extends TestCase
+{
+    public function testSnakeCaseKey()
+    {
+        $a = [
+            'myName' => 'yansongda',
+            'myAge' => 27,
+            'family' => [
+                'hasChildren' => false,
+            ]
+        ];
+        $expect = [
+            'my_name' => 'yansongda',
+            'my_age' => 27,
+            'family' => [
+                'has_children' => false,
+            ]
+        ];
+        self::assertEqualsCanonicalizing($expect, Arr::snakeCaseKey($a));
+
+        $obj =  new stdClass();
+        $a = [
+            'myName' => 'yansongda',
+            'myAge' => 27,
+            'family' => [
+                'hasChildren' => $obj,
+            ]
+        ];
+        $expect = [
+            'my_name' => 'yansongda',
+            'my_age' => 27,
+            'family' => [
+                'has_children' => $obj,
+            ]
+        ];
+        self::assertEqualsCanonicalizing($expect, Arr::snakeCaseKey($a));
+    }
+
+    public function testCamelCaseKey()
+    {
+        $a = [
+            'my_name' => 'yansongda',
+            'my_age' => 27,
+            'family' => [
+                'has_children' => false,
+            ]
+        ];
+        $expect = [
+            'myName' => 'yansongda',
+            'myAge' => 27,
+            'family' => [
+                'hasChildren' => false,
+            ]
+        ];
+        self::assertEqualsCanonicalizing($expect, Arr::camelCaseKey($a));
+    }
+
+    public function testCamelCaseKeyWithObject()
+    {
+        $obj = new Class {
+            public function toArray(): array
+            {
+                return ['name' => 'yansongda'];
+            }
+        };
+
+        $a = [
+            'my_name' => 'yansongda',
+            'my_age' => 27,
+            'family' => [
+                'has_children' => false,
+            ],
+            'objs' => [
+                $obj,
+            ]
+        ];
+        $expect = [
+            'myName' => 'yansongda',
+            'myAge' => 27,
+            'family' => [
+                'hasChildren' => false,
+            ],
+            'objs' => [
+                ['name' => 'yansongda'],
+            ]
+        ];
+        self::assertEqualsCanonicalizing($expect, Arr::camelCaseKey($a));
+    }
+
+    public function testToString()
+    {
+        $a = [
+            'my_name' => 'yansongda',
+            'my_age' => 27,
+        ];
+
+        self::assertEquals('my_name=yansongda&my_age=27', Arr::toString($a));
+    }
+}

+ 102 - 0
vendor/yansongda/supports/tests/CollectionTest.php

@@ -0,0 +1,102 @@
+<?php
+
+namespace Yansongda\Supports\Tests;
+
+use PHPUnit\Framework\TestCase;
+use Yansongda\Supports\Collection;
+
+class CollectionTest extends TestCase
+{
+    /**
+     * data.
+     *
+     * @var array
+     */
+    protected $data = [];
+
+    /**
+     * collection.
+     *
+     * @var Collection
+     */
+    protected $collection;
+
+    protected function setUp(): void
+    {
+        $this->data = [
+            'name' => 'yansongda',
+            'age' => 26,
+            'sex' => 1,
+            'language' => [
+                'php',
+                'java',
+                'rust',
+            ],
+        ];
+        $this->collection = new Collection($this->data);
+    }
+
+    public function testToString()
+    {
+        $json = json_encode($this->data);
+
+        self::assertEquals($json, $this->collection->toJson());
+        self::assertEquals($json, $this->collection->__toString());
+    }
+
+    public function testMagicGet()
+    {
+        self::assertEquals('yansongda', $this->collection->name);
+        self::assertEqualsCanonicalizing(['php', 'java', 'rust'], $this->collection->language);
+    }
+
+    public function testMagicSet()
+    {
+        $this->collection->fuck = 'ok';
+        $this->collection->foo = ['bar', 'fuck'];
+
+        self::assertEquals('ok', $this->collection->get('fuck'));
+        self::assertEquals(['bar', 'fuck'], $this->collection->get('foo'));
+    }
+
+    public function testIsset()
+    {
+        self::assertTrue(isset($this->collection['name']));
+        self::assertFalse(isset($this->collection['notExistKey']));
+    }
+
+    public function testUnset()
+    {
+        unset($this->collection['name']);
+
+        self::assertFalse(isset($this->collection['name']));
+    }
+
+    public function testAll()
+    {
+        self::assertEquals($this->data, $this->collection->all());
+    }
+
+    public function testOnly()
+    {
+        self::assertEquals([
+            'name' => 'yansongda',
+        ], $this->collection->only(['name']));
+    }
+
+    public function testExcept()
+    {
+        self::assertEquals([
+            'name' => 'yansongda',
+            'age' => 26,
+            'sex' => 1,
+        ], $this->collection->except('language')->all());
+    }
+
+    public function testMerge()
+    {
+        $merge = ['haha' => 'enen'];
+
+        self::assertEqualsCanonicalizing(array_merge($this->data, $merge), $this->collection->merge($merge)->all());
+    }
+}

+ 17 - 0
vendor/yansongda/supports/tests/ConfigTest.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace Yansongda\Supports\Tests;
+
+use PHPUnit\Framework\TestCase;
+use Yansongda\Supports\Collection;
+use Yansongda\Supports\Config;
+
+class ConfigTest extends TestCase
+{
+    public function testBootstrap()
+    {
+        $config = [];
+
+        self::assertInstanceOf(Collection::class, new Config($config));
+    }
+}

+ 18 - 0
vendor/yansongda/supports/tests/FunctionTest.php

@@ -0,0 +1,18 @@
+<?php
+
+namespace Yansongda\Supports\Tests;
+
+use PHPUnit\Framework\TestCase;
+
+class FunctionTest extends TestCase
+{
+    public function testNamespace()
+    {
+        self::assertFalse(function_exists('collect'));
+        self::assertFalse(function_exists('value'));
+        self::assertFalse(function_exists('data_get'));
+        self::assertTrue(function_exists('Yansongda\Supports\collect'));
+        self::assertTrue(function_exists('Yansongda\Supports\value'));
+        self::assertTrue(function_exists('Yansongda\Supports\data_get'));
+    }
+}

+ 239 - 0
vendor/yansongda/supports/tests/PipelineTest.php

@@ -0,0 +1,239 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Yansongda\Supports\Tests;
+
+use Yansongda\Supports\Pipeline;
+use Yansongda\Supports\Tests\Stubs\FooPipeline;
+use Mockery;
+use PHPUnit\Framework\TestCase;
+use Psr\Container\ContainerInterface;
+
+/**
+ * @internal
+ * @coversNothing
+ */
+class PipelineTest extends TestCase
+{
+    protected function tearDown(): void
+    {
+        Mockery::close();
+    }
+
+    public function testPipelineBasicUsage()
+    {
+        $pipeTwo = function ($piped, $next) {
+            $_SERVER['__test.pipe.two'] = $piped;
+
+            return $next($piped);
+        };
+
+        $result = (new Pipeline($this->getContainer()))
+            ->send('foo')
+            ->through([PipelineTestPipeOne::class, $pipeTwo])
+            ->then(function ($piped) {
+                return $piped;
+            });
+
+        static::assertSame('foo', $result);
+        static::assertSame('foo', $_SERVER['__test.pipe.one']);
+        static::assertSame('foo', $_SERVER['__test.pipe.two']);
+
+        unset($_SERVER['__test.pipe.one'], $_SERVER['__test.pipe.two']);
+    }
+
+    public function testPipelineUsageWithObjects()
+    {
+        $result = (new Pipeline($this->getContainer()))
+            ->send('foo')
+            ->through([new PipelineTestPipeOne()])
+            ->then(function ($piped) {
+                return $piped;
+            });
+
+        static::assertSame('foo', $result);
+        static::assertSame('foo', $_SERVER['__test.pipe.one']);
+
+        unset($_SERVER['__test.pipe.one']);
+    }
+
+    public function testPipelineUsageWithInvokableObjects()
+    {
+        $result = (new Pipeline($this->getContainer()))
+            ->send('foo')
+            ->through([new PipelineTestPipeTwo()])
+            ->then(
+                function ($piped) {
+                    return $piped;
+                }
+            );
+
+        static::assertSame('foo', $result);
+        static::assertSame('foo', $_SERVER['__test.pipe.one']);
+
+        unset($_SERVER['__test.pipe.one']);
+    }
+
+    public function testPipelineUsageWithCallable()
+    {
+        $function = function ($piped, $next) {
+            $_SERVER['__test.pipe.one'] = 'foo';
+
+            return $next($piped);
+        };
+
+        $result = (new Pipeline($this->getContainer()))
+            ->send('foo')
+            ->through([$function])
+            ->then(
+                function ($piped) {
+                    return $piped;
+                }
+            );
+
+        static::assertSame('foo', $result);
+        static::assertSame('foo', $_SERVER['__test.pipe.one']);
+
+        unset($_SERVER['__test.pipe.one']);
+
+        $result = (new Pipeline($this->getContainer()))
+            ->send('bar')
+            ->through($function)
+            ->then(static function ($passable) {
+                return $passable;
+            });
+
+        static::assertSame('bar', $result);
+        static::assertSame('foo', $_SERVER['__test.pipe.one']);
+
+        unset($_SERVER['__test.pipe.one']);
+    }
+
+    public function testPipelineUsageWithInvokableClass()
+    {
+        $result = (new Pipeline($this->getContainer()))
+            ->send('foo')
+            ->through([PipelineTestPipeTwo::class])
+            ->then(
+                function ($piped) {
+                    return $piped;
+                }
+            );
+
+        static::assertSame('foo', $result);
+        static::assertSame('foo', $_SERVER['__test.pipe.one']);
+
+        unset($_SERVER['__test.pipe.one']);
+    }
+
+    public function testPipelineUsageWithParameters()
+    {
+        $parameters = ['one', 'two'];
+
+        $result = (new Pipeline($this->getContainer()))
+            ->send('foo')
+            ->through(PipelineTestParameterPipe::class . ':' . implode(',', $parameters))
+            ->then(function ($piped) {
+                return $piped;
+            });
+
+        static::assertSame('foo', $result);
+        static::assertEquals($parameters, $_SERVER['__test.pipe.parameters']);
+
+        unset($_SERVER['__test.pipe.parameters']);
+    }
+
+    public function testPipelineViaChangesTheMethodBeingCalledOnThePipes()
+    {
+        $pipelineInstance = new Pipeline($this->getContainer());
+        $result = $pipelineInstance->send('data')
+            ->through(PipelineTestPipeOne::class)
+            ->via('differentMethod')
+            ->then(function ($piped) {
+                return $piped;
+            });
+        static::assertSame('data', $result);
+    }
+
+    public function testPipelineThenReturnMethodRunsPipelineThenReturnsPassable()
+    {
+        $result = (new Pipeline($this->getContainer()))
+            ->send('foo')
+            ->through([PipelineTestPipeOne::class])
+            ->then(static function ($passable) {
+                return $passable;
+            });
+
+        static::assertSame('foo', $result);
+        static::assertSame('foo', $_SERVER['__test.pipe.one']);
+
+        unset($_SERVER['__test.pipe.one']);
+    }
+
+    public function testHandleCarry()
+    {
+        $result = (new FooPipeline($this->getContainer()))
+            ->send($id = rand(0, 99))
+            ->through([PipelineTestPipeOne::class])
+            ->via('incr')
+            ->then(static function ($passable) {
+                if (is_int($passable)) {
+                    $passable += 3;
+                }
+                return $passable;
+            });
+
+        static::assertSame($id + 6, $result);
+    }
+
+    protected function getContainer()
+    {
+        $container = Mockery::mock(ContainerInterface::class);
+        $container->shouldReceive('get')->with(PipelineTestPipeOne::class)->andReturn(new PipelineTestPipeOne());
+        $container->shouldReceive('get')->with(PipelineTestPipeTwo::class)->andReturn(new PipelineTestPipeTwo());
+        $container->shouldReceive('get')->with(PipelineTestParameterPipe::class)->andReturn(new PipelineTestParameterPipe());
+
+        return $container;
+    }
+}
+
+class PipelineTestPipeOne
+{
+    public function handle($piped, $next)
+    {
+        $_SERVER['__test.pipe.one'] = $piped;
+
+        return $next($piped);
+    }
+
+    public function differentMethod($piped, $next)
+    {
+        return $next($piped);
+    }
+
+    public function incr($piped, $next)
+    {
+        return $next(++$piped);
+    }
+}
+
+class PipelineTestPipeTwo
+{
+    public function __invoke($piped, $next)
+    {
+        $_SERVER['__test.pipe.one'] = $piped;
+
+        return $next($piped);
+    }
+}
+
+class PipelineTestParameterPipe
+{
+    public function handle($piped, $next, $parameter1 = null, $parameter2 = null)
+    {
+        $_SERVER['__test.pipe.parameters'] = [$parameter1, $parameter2];
+
+        return $next($piped);
+    }
+}

+ 33 - 0
vendor/yansongda/supports/tests/StrTest.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace Yansongda\Supports\Tests;
+
+use PHPUnit\Framework\TestCase;
+use Yansongda\Supports\Str;
+
+class StrTest extends TestCase
+{
+    public function testCamel()
+    {
+        self::assertSame('helloWorld', Str::camel('HelloWorld'));
+        self::assertSame('helloWorld', Str::camel('hello_world'));
+        self::assertSame('helloWorld', Str::camel('hello-world'));
+        self::assertSame('helloWorld', Str::camel('hello world'));
+    }
+
+    public function testSnake()
+    {
+        self::assertSame('hello_world', Str::snake('HelloWorld'));
+        self::assertSame('hello_world', Str::snake('hello_world'));
+        self::assertSame('hello_world', Str::snake('hello world'));
+    }
+
+    public function testStudly()
+    {
+        self::assertSame('HelloWorld', Str::studly('helloWorld'));
+        self::assertSame('HelloWorld', Str::studly('hello_world'));
+        self::assertSame('HelloWorld', Str::studly('hello-world'));
+        self::assertSame('HelloWorld', Str::studly('hello world'));
+        self::assertSame('Hello-World', Str::studly('hello world', '-'));
+    }
+}

+ 19 - 0
vendor/yansongda/supports/tests/Stubs/FooPipeline.php

@@ -0,0 +1,19 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Yansongda\Supports\Tests\Stubs;
+
+use Yansongda\Supports\Pipeline;
+
+class FooPipeline extends Pipeline
+{
+    protected function handleCarry(mixed $carry): mixed
+    {
+        $carry = parent::handleCarry($carry);
+        if (is_int($carry)) {
+            $carry += 2;
+        }
+        return $carry;
+    }
+}

+ 31 - 0
vendor/yansongda/supports/tests/Stubs/TraitStub.php

@@ -0,0 +1,31 @@
+<?php
+
+namespace Yansongda\Supports\Tests\Stubs;
+
+use ArrayAccess;
+use JsonSerializable as JsonSerializableInterface;
+use Yansongda\Supports\Traits\Accessable;
+use Yansongda\Supports\Traits\Arrayable;
+use Yansongda\Supports\Traits\Serializable;
+
+class TraitStub  implements JsonSerializableInterface, ArrayAccess, \Serializable
+{
+    use Accessable;
+    use Arrayable;
+    use Serializable;
+
+    private $name = 'yansongda';
+
+    private $fooBar = 'name';
+
+    public function getName(): string
+    {
+        return $this->name;
+    }
+
+    public function setName(string $name): TraitStub
+    {
+        $this->name = $name;
+        return $this;
+    }
+}

+ 29 - 0
vendor/yansongda/supports/tests/Traits/ArrayAccessTest.php

@@ -0,0 +1,29 @@
+<?php
+
+namespace Yansongda\Supports\Tests\Traits;
+
+use PHPUnit\Framework\TestCase;
+use Yansongda\Supports\Tests\Stubs\TraitStub;
+
+class ArrayAccessTest extends TestCase
+{
+    protected $class;
+
+    protected function setUp(): void
+    {
+        $this->class = new TraitStub();
+    }
+
+    public function testAccess()
+    {
+        self::assertEquals('yansongda', $this->class->name);
+
+        $this->class->name = 'you';
+        self::assertEquals('you', $this->class->name);
+    }
+
+    public function testArray()
+    {
+        self::assertEqualsCanonicalizing(['name' => 'yansongda', 'foo_bar' => 'name'], $this->class->toArray());
+    }
+}

+ 30 - 0
vendor/yansongda/supports/tests/Traits/SerializableTest.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace Yansongda\Supports\Tests\Traits;
+
+use PHPUnit\Framework\TestCase;
+use Yansongda\Supports\Tests\Stubs\TraitStub;
+
+class SerializableTest extends TestCase
+{
+    protected $class;
+
+    protected function setUp(): void
+    {
+        $this->class = new TraitStub();
+    }
+
+    public function testSerializeFunction()
+    {
+        self::assertStringContainsString('yansongda', serialize($this->class));
+        self::assertEquals('yansongda', unserialize(serialize($this->class))->getName());
+    }
+
+    public function testUnserializeArray()
+    {
+        $traitStub = $this->class->unserializeArray(['name' => 'yansongda-a']);
+
+        self::assertInstanceOf(TraitStub::class, $traitStub);
+        self::assertEquals('yansongda-a', $traitStub->getName());
+    }
+}