lockfile again

This commit is contained in:
Tim Bendt
2025-11-26 11:50:55 -05:00
parent af3c23cb6e
commit 6ceecaa69e
4461 changed files with 641349 additions and 10 deletions

15
vendor/spatie/once/.editorconfig vendored Normal file
View File

@@ -0,0 +1,15 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org
root = true
[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

View File

@@ -0,0 +1 @@
custom: https://spatie.be/open-source/support-us

View File

@@ -0,0 +1,44 @@
name: run-tests
on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
php: [7.4, 7.3, 7.2]
dependency-version: [prefer-lowest, prefer-stable]
os: [ubuntu-latest, windows-latest]
name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json, dom, curl, libxml, mbstring
coverage: none
- name: Install dependencies
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
- name: Configure matchers
uses: mheap/phpunit-matcher-action@master
- name: Execute tests
run: vendor/bin/phpunit --teamcity

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

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Spatie bvba <info@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.

46
vendor/spatie/once/composer.json vendored Normal file
View File

@@ -0,0 +1,46 @@
{
"name": "spatie/once",
"description": "A magic memoization function",
"keywords": [
"spatie",
"once",
"callable",
"memozation",
"cache"
],
"homepage": "https://github.com/spatie/once",
"license": "MIT",
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"require": {
"php": "^7.2|^8.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0"
},
"autoload": {
"psr-4": {
"Spatie\\Once\\": "src"
},
"files": [
"src/functions.php"
]
},
"autoload-dev": {
"psr-4": {
"Spatie\\Once\\Test\\": "tests"
}
},
"scripts": {
"test": "vendor/bin/phpunit"
},
"config": {
"sort-packages": true
}
}

64
vendor/spatie/once/src/Backtrace.php vendored Normal file
View File

@@ -0,0 +1,64 @@
<?php
namespace Spatie\Once;
class Backtrace
{
/** @var array */
protected $trace;
/** @var array */
protected $zeroStack;
public function __construct(array $trace)
{
$this->trace = $trace[1];
$this->zeroStack = $trace[0];
}
public function getArguments(): array
{
return $this->trace['args'];
}
public function getFunctionName(): string
{
return $this->trace['function'];
}
/**
* @return mixed
*/
public function getObject()
{
if ($this->globalFunction()) {
return $this->zeroStack['file'];
}
return $this->staticCall() ? $this->trace['class'] : $this->trace['object'];
}
public function getHash(): string
{
$normalizedArguments = array_map(function ($argument) {
return is_object($argument) ? spl_object_hash($argument) : $argument;
}, $this->getArguments());
$prefix = $this->getFunctionName();
if (strpos($prefix, '{closure}') !== false) {
$prefix = $this->zeroStack['line'];
}
return md5($prefix.serialize($normalizedArguments));
}
protected function staticCall()
{
return $this->trace['type'] == '::';
}
protected function globalFunction()
{
return ! isset($this->trace['type']);
}
}

111
vendor/spatie/once/src/Cache.php vendored Normal file
View File

@@ -0,0 +1,111 @@
<?php
namespace Spatie\Once;
class Cache
{
/** @var array */
public static $values = [];
/** @var bool */
protected static $enabled = true;
/**
* Determine if a value exists for a given object / hash.
*
* @param mixed $object
* @param string $backtraceHash
*
* @return bool
*/
public static function has($object, string $backtraceHash): bool
{
$objectHash = static::objectHash($object);
if (! isset(static::$values[$objectHash])) {
return false;
}
return array_key_exists($backtraceHash, static::$values[$objectHash]);
}
/**
* Retrieve a value for an object / hash.
*
* @param mixed $object
* @param string $backtraceHash
*
* @return mixed
*/
public static function get($object, string $backtraceHash)
{
return static::$values[static::objectHash($object)][$backtraceHash];
}
/**
* Set a cached value for an object / hash.
*
* @param mixed $object
* @param string $backtraceHash
* @param mixed $value
*/
public static function set($object, string $backtraceHash, $value)
{
static::addDestroyListener($object);
static::$values[static::objectHash($object)][$backtraceHash] = $value;
}
/**
* Forget the stored items for the given objectHash.
*
* @param string $objectHash
*/
public static function forget(string $objectHash)
{
unset(static::$values[$objectHash]);
}
/**
* Flush the entire cache.
*/
public static function flush()
{
static::$values = [];
}
protected static function objectHash($object): string
{
return is_string($object) ? $object : spl_object_hash($object);
}
protected static function addDestroyListener($object)
{
if (is_string($object)) {
return;
}
$randomPropertyName = '___once_listener__'.rand(1, 1000000);
if (isset($object->$randomPropertyName)) {
return;
}
$object->$randomPropertyName = new Listener($object);
}
public static function disable()
{
static::$enabled = false;
}
public static function enable()
{
static::$enabled = true;
}
public static function isEnabled(): bool
{
return static::$enabled;
}
}

26
vendor/spatie/once/src/Listener.php vendored Normal file
View File

@@ -0,0 +1,26 @@
<?php
namespace Spatie\Once;
class Listener
{
/** @var bool */
private $hasBeenSerialized = false;
public function __construct($object)
{
$this->objectHash = spl_object_hash($object);
}
public function __destruct()
{
if (! $this->hasBeenSerialized) {
Cache::forget($this->objectHash);
}
}
public function __wakeup()
{
$this->hasBeenSerialized = true;
}
}

33
vendor/spatie/once/src/functions.php vendored Normal file
View File

@@ -0,0 +1,33 @@
<?php
use Spatie\Once\Backtrace;
use Spatie\Once\Cache;
function once($callback)
{
$trace = debug_backtrace(
DEBUG_BACKTRACE_PROVIDE_OBJECT, 2
);
$backtrace = new Backtrace($trace);
if ($backtrace->getFunctionName() === 'eval') {
return call_user_func($callback);
}
$object = $backtrace->getObject();
$hash = $backtrace->getHash();
if (! Cache::isEnabled()) {
return call_user_func($callback, $backtrace->getArguments());
}
if (! Cache::has($object, $hash)) {
$result = call_user_func($callback, $backtrace->getArguments());
Cache::set($object, $hash, $result);
}
return Cache::get($object, $hash);
}