[增添]添加了datasource的setting数据库以及默认值

This commit is contained in:
makotocc0107
2024-08-27 09:57:44 +08:00
parent d111dfaea4
commit 72eb990970
10955 changed files with 978898 additions and 0 deletions

96
vendor/spatie/invade/CHANGELOG.md vendored Normal file
View File

@@ -0,0 +1,96 @@
# Changelog
All notable changes to `invade` will be documented in this file.
## 2.0.0 - 2023-07-19
### What's Changed
- invade without reflection by @enricodelazzari in https://github.com/spatie/invade/pull/24
### New Contributors
- @enricodelazzari made their first contribution in https://github.com/spatie/invade/pull/24
**Full Changelog**: https://github.com/spatie/invade/compare/1.1.1...2.0.0
## 1.1.1 - 2022-07-05
### What's Changed
- Bump dependabot/fetch-metadata from 1.3.1 to 1.3.3 by @dependabot in https://github.com/spatie/invade/pull/13
- Improve the PHPStan extension by @jrmajor in https://github.com/spatie/invade/pull/14
### New Contributors
- @jrmajor made their first contribution in https://github.com/spatie/invade/pull/14
**Full Changelog**: https://github.com/spatie/invade/compare/1.1.0...1.1.1
## 1.1.0 - 2022-07-02
### What's Changed
- Add phpstan support to not report access to private properties/methods by @tpetry in https://github.com/spatie/invade/pull/12
### New Contributors
- @tpetry made their first contribution in https://github.com/spatie/invade/pull/12
**Full Changelog**: https://github.com/spatie/invade/compare/1.0.3...1.1.0
## 1.0.3 - 2022-06-06
### What's Changed
- Bump dependabot/fetch-metadata from 1.2.0 to 1.2.1 by @dependabot in https://github.com/spatie/invade/pull/8
- Bump dependabot/fetch-metadata from 1.2.1 to 1.3.0 by @dependabot in https://github.com/spatie/invade/pull/9
- Bump dependabot/fetch-metadata from 1.3.0 to 1.3.1 by @dependabot in https://github.com/spatie/invade/pull/11
- Add type checking via phpstan by @olivernybroe in https://github.com/spatie/invade/pull/5
- Bump actions/checkout from 2 to 3 by @dependabot in https://github.com/spatie/invade/pull/10
### New Contributors
- @olivernybroe made their first contribution in https://github.com/spatie/invade/pull/5
**Full Changelog**: https://github.com/spatie/invade/compare/1.0.2...1.0.3
## 1.0.2 - 2022-02-21
## What's Changed
- Bump dependabot/fetch-metadata from 1.1.1 to 1.2.0 by @dependabot in https://github.com/spatie/invade/pull/6
- Add brand new logo to the project by @caneco in https://github.com/spatie/invade/pull/7
## New Contributors
- @dependabot made their first contribution in https://github.com/spatie/invade/pull/6
- @caneco made their first contribution in https://github.com/spatie/invade/pull/7
**Full Changelog**: https://github.com/spatie/invade/compare/1.0.1...1.0.2
## 1.0.1 - 2022-02-11
## What's Changed
- Invador -> Invader spelling by @danharrin in https://github.com/spatie/invade/pull/2
- Only declare function if it does not already exist by @benjam-es in https://github.com/spatie/invade/pull/1
## New Contributors
- @danharrin made their first contribution in https://github.com/spatie/invade/pull/2
- @benjam-es made their first contribution in https://github.com/spatie/invade/pull/1
**Full Changelog**: https://github.com/spatie/invade/compare/1.0.0...1.0.1
## 0.0.2 - 2022-02-11
- experimental release
## 0.0.1 - 2022-02-11
- experimental release
## 1.0.0 - 202X-XX-XX
- initial release

21
vendor/spatie/invade/LICENSE.md vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) spatie <freek@spatie.be>
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.

127
vendor/spatie/invade/README.md vendored Normal file
View File

@@ -0,0 +1,127 @@
<p align="center"><img src="/art/socialcard.png" alt="Social Card of Invade"></p>
# A PHP function to access private properties and methods
[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/invade.svg?style=flat-square)](https://packagist.org/packages/spatie/invade)
[![Tests](https://github.com/spatie/invade/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/spatie/invade/actions/workflows/run-tests.yml)
[![Total Downloads](https://img.shields.io/packagist/dt/spatie/invade.svg?style=flat-square)](https://packagist.org/packages/spatie/invade)
This package offers an `invade` function that will allow you to read/write private properties of an object. It will also allow you to call private methods.
## Support us
[<img src="https://github-ads.s3.eu-central-1.amazonaws.com/invade.jpg?t=1" width="419px" />](https://spatie.be/github-ad-click/invade)
We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).
## Installation
You can install the package via composer:
```bash
composer require spatie/invade
```
## Usage
Imagine you have this class defined which has a private property and method.
```php
class MyClass
{
private string $privateProperty = 'private value';
private function privateMethod(): string
{
return 'private return value';
}
}
$myClass = new Myclass();
```
This is how you can get the value of the private property using the `invade` function.
```php
invade($myClass)->privateProperty; // returns 'private value'
```
The `invade` function also allows you to change private values.
```php
invade($myClass)->privateProperty = 'changed value';
invade($myClass)->privateProperty; // returns 'changed value
```
Using `invade` you can also call private functions.
```php
invade($myClass)->privateMethod(); // returns 'private return value'
```
Further, you can also get and set private static class properties and call private static methods. Imagine having this class:
```php
class MyClass
{
private static string $privateStaticProperty = 'privateValue';
private static function privateStaticMethod(string $string, int $int): string
{
return 'private return value ' . $string . ' ' . $int;
}
}
```
Here is how you get and set private class properties:
```php
invade(MyClass::class)->get('privateStaticProperty'); // returns 'private value'
invade(MyClass::class)->set('privateStaticProperty', 'changedValue');
invade(MyClass::class)->get('privateStaticProperty'); // returns 'changedValue'
```
And this is how you call private static methods:
```php
invade(MyClass::class)
->method('privateStaticMethod')
->call('foo', 123);
// returns 'private return value foo 123'
```
## Testing
```bash
composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Freek Van der Herten](https://github.com/spatie)
- [All Contributors](../../contributors)
And a special thanks to [Caneco](https://twitter.com/caneco) for the logo ✨
The [original idea](https://twitter.com/calebporzio/status/1492141967404371968) for the `invade` function came from [Caleb "string king" Porzio](https://twitter.com/calebporzio). We slightly polished the code that he created in [this commit on Livewire](https://github.com/livewire/livewire/pull/4649/files).
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

51
vendor/spatie/invade/composer.json vendored Normal file
View File

@@ -0,0 +1,51 @@
{
"name": "spatie/invade",
"description": "A PHP function to work with private properties and methods",
"keywords": [
"spatie",
"invade"
],
"homepage": "https://github.com/spatie/invade",
"license": "MIT",
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"role": "Developer"
}
],
"require": {
"php": "^8.0"
},
"require-dev": {
"pestphp/pest": "^1.20",
"phpstan/phpstan": "^1.4",
"spatie/ray": "^1.28"
},
"autoload": {
"psr-4": {
"Spatie\\Invade\\": "src"
},
"files": [
"src/functions.php"
]
},
"autoload-dev": {
"psr-4": {
"Spatie\\Invade\\Tests\\": "tests"
}
},
"scripts": {
"analyse": "vendor/bin/phpstan analyse",
"test": "vendor/bin/pest",
"test-coverage": "vendor/bin/pest --coverage"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
}

View File

View File

@@ -0,0 +1,9 @@
includes:
- phpstan-baseline.neon
parameters:
level: 4
paths:
- src
tmpDir: build/phpstan
checkMissingIterableValueType: false

33
vendor/spatie/invade/src/Invader.php vendored Normal file
View File

@@ -0,0 +1,33 @@
<?php
namespace Spatie\Invade;
/**
* @template T of object
* @mixin T
*/
class Invader
{
/**
* @param T $obj
*/
public function __construct(
public object $obj
) {
}
public function __get(string $name): mixed
{
return (fn () => $this->{$name})->call($this->obj);
}
public function __set(string $name, mixed $value): void
{
(fn () => $this->{$name} = $value)->call($this->obj);
}
public function __call(string $name, array $params = []): mixed
{
return (fn () => $this->{$name}(...$params))->call($this->obj);
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace Spatie\Invade;
use Exception;
class StaticInvader
{
private ?string $method = null;
/**
* @param class-string $className
*/
public function __construct(
public string $className,
) {
}
public function get(string $name): mixed
{
return (fn () => static::${$name})->bindTo(null, $this->className)();
}
public function set(string $name, mixed $value): void
{
(fn ($value) => static::${$name} = $value)->bindTo(null, $this->className)($value);
}
public function method(string $name): self
{
$this->method = $name;
return $this;
}
/**
* @throws Exception
*/
public function call(...$params): mixed
{
if ($this->method === null) {
throw new Exception(
'No method to be called. Use it like: invadeStatic(Foo::class)->method(\'bar\')->call()'
);
}
return (fn ($method) => static::{$method}(...$params))->bindTo(null, $this->className)($this->method);
}
}

21
vendor/spatie/invade/src/functions.php vendored Normal file
View File

@@ -0,0 +1,21 @@
<?php
use Spatie\Invade\Invader;
use Spatie\Invade\StaticInvader;
if (! function_exists('invade')) {
/**
* @template T of object
*
* @param T|class-string $object
* @return Invader<T>|StaticInvader
*/
function invade(object|string $object): Invader|StaticInvader
{
if (is_object($object)) {
return new Invader($object);
}
return new StaticInvader($object);
}
}