chore(web): move gregwar/captcha
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-10-08 19:58:22 +08:00
parent b6e83e1535
commit 2fcc71029e
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
89 changed files with 1218 additions and 659 deletions

5
web/app/composer.json Normal file
View File

@ -0,0 +1,5 @@
{
"require": {
"gregwar/captcha": "^1.1"
}
}

View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInite9f59116cb3d815416daaf015687f2ec::getLoader(); return ComposerAutoloaderInit0d7c2cd5c2dbf2120e4372996869e900::getLoader();

View File

@ -37,8 +37,8 @@ namespace Composer\Autoload;
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be> * @author Jordi Boggiano <j.boggiano@seld.be>
* @see https://www.php-fig.org/psr/psr-0/ * @see http://www.php-fig.org/psr/psr-0/
* @see https://www.php-fig.org/psr/psr-4/ * @see http://www.php-fig.org/psr/psr-4/
*/ */
class ClassLoader class ClassLoader
{ {
@ -60,7 +60,7 @@ class ClassLoader
public function getPrefixes() public function getPrefixes()
{ {
if (!empty($this->prefixesPsr0)) { if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); return call_user_func_array('array_merge', $this->prefixesPsr0);
} }
return array(); return array();

View File

@ -1,4 +1,3 @@
Copyright (c) Nils Adermann, Jordi Boggiano Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
@ -18,4 +17,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 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 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.

View File

@ -0,0 +1,14 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
);

View File

@ -0,0 +1,11 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
);

View File

@ -6,6 +6,7 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(
'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'), 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
'Gregwar\\' => array($vendorDir . '/gregwar/captcha/src/Gregwar'), 'Gregwar\\' => array($vendorDir . '/gregwar/captcha/src/Gregwar'),
); );

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInite9f59116cb3d815416daaf015687f2ec class ComposerAutoloaderInit0d7c2cd5c2dbf2120e4372996869e900
{ {
private static $loader; private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInite9f59116cb3d815416daaf015687f2ec
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInite9f59116cb3d815416daaf015687f2ec', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInit0d7c2cd5c2dbf2120e4372996869e900', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(); self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInite9f59116cb3d815416daaf015687f2ec', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInit0d7c2cd5c2dbf2120e4372996869e900', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) { if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php'; require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInite9f59116cb3d815416daaf015687f2ec::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInit0d7c2cd5c2dbf2120e4372996869e900::getInitializer($loader));
} else { } else {
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {
@ -50,6 +50,24 @@ class ComposerAutoloaderInite9f59116cb3d815416daaf015687f2ec
$loader->register(true); $loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit0d7c2cd5c2dbf2120e4372996869e900::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire0d7c2cd5c2dbf2120e4372996869e900($fileIdentifier, $file);
}
return $loader; return $loader;
} }
} }
function composerRequire0d7c2cd5c2dbf2120e4372996869e900($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}

View File

@ -0,0 +1,58 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInit0d7c2cd5c2dbf2120e4372996869e900
{
public static $files = array (
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
);
public static $prefixLengthsPsr4 = array (
'S' =>
array (
'Symfony\\Polyfill\\Php80\\' => 23,
'Symfony\\Component\\Finder\\' => 25,
),
'G' =>
array (
'Gregwar\\' => 8,
),
);
public static $prefixDirsPsr4 = array (
'Symfony\\Polyfill\\Php80\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-php80',
),
'Symfony\\Component\\Finder\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/finder',
),
'Gregwar\\' =>
array (
0 => __DIR__ . '/..' . '/gregwar/captcha/src/Gregwar',
),
);
public static $classMap = array (
'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit0d7c2cd5c2dbf2120e4372996869e900::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit0d7c2cd5c2dbf2120e4372996869e900::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit0d7c2cd5c2dbf2120e4372996869e900::$classMap;
}, null, ClassLoader::class);
}
}

267
web/app/vendor/composer/installed.json vendored Normal file
View File

@ -0,0 +1,267 @@
[
{
"name": "gregwar/captcha",
"version": "v1.1.9",
"version_normalized": "1.1.9.0",
"source": {
"type": "git",
"url": "https://github.com/Gregwar/Captcha.git",
"reference": "4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Gregwar/Captcha/zipball/4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5",
"reference": "4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5",
"shasum": ""
},
"require": {
"ext-gd": "*",
"ext-mbstring": "*",
"php": ">=5.3.0",
"symfony/finder": "*"
},
"require-dev": {
"phpunit/phpunit": "^6.4"
},
"time": "2020-03-24T14:39:05+00:00",
"type": "captcha",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Gregwar\\": "src/Gregwar"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Grégoire Passault",
"email": "g.passault@gmail.com",
"homepage": "http://www.gregwar.com/"
},
{
"name": "Jeremy Livingston",
"email": "jeremy.j.livingston@gmail.com"
}
],
"description": "Captcha generator",
"homepage": "https://github.com/Gregwar/Captcha",
"keywords": [
"bot",
"captcha",
"spam"
]
},
{
"name": "symfony/deprecation-contracts",
"version": "v2.5.2",
"version_normalized": "2.5.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66",
"reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"time": "2022-01-02T09:53:40+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "2.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"installation-source": "dist",
"autoload": {
"files": [
"function.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
]
},
{
"name": "symfony/finder",
"version": "v5.4.11",
"version_normalized": "5.4.11.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "7872a66f57caffa2916a584db1aa7f12adc76f8c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/7872a66f57caffa2916a584db1aa7f12adc76f8c",
"reference": "7872a66f57caffa2916a584db1aa7f12adc76f8c",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1|^3",
"symfony/polyfill-php80": "^1.16"
},
"time": "2022-07-29T07:37:50+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\Finder\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
]
},
{
"name": "symfony/polyfill-php80",
"version": "v1.26.0",
"version_normalized": "1.26.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace",
"reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"time": "2022-05-10T07:21:04+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.26-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"installation-source": "dist",
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ion Bazan",
"email": "ion.bazan@gmail.com"
},
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
]
}
]

View File

@ -0,0 +1,3 @@
vendor/
composer.lock
phpunit.xml

View File

@ -0,0 +1,5 @@
CHANGELOG
=========
The changelog is maintained for all Symfony contracts at the following URL:
https://github.com/symfony/contracts/blob/main/CHANGELOG.md

View File

@ -0,0 +1,19 @@
Copyright (c) 2020-2022 Fabien Potencier
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.

View File

@ -0,0 +1,26 @@
Symfony Deprecation Contracts
=============================
A generic function and convention to trigger deprecation notices.
This package provides a single global function named `trigger_deprecation()` that triggers silenced deprecation notices.
By using a custom PHP error handler such as the one provided by the Symfony ErrorHandler component,
the triggered deprecations can be caught and logged for later discovery, both on dev and prod environments.
The function requires at least 3 arguments:
- the name of the Composer package that is triggering the deprecation
- the version of the package that introduced the deprecation
- the message of the deprecation
- more arguments can be provided: they will be inserted in the message using `printf()` formatting
Example:
```php
trigger_deprecation('symfony/blockchain', '8.9', 'Using "%s" is deprecated, use "%s" instead.', 'bitcoin', 'fabcoin');
```
This will generate the following message:
`Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.`
While not necessarily recommended, the deprecation notices can be completely ignored by declaring an empty
`function trigger_deprecation() {}` in your application.

View File

@ -0,0 +1,35 @@
{
"name": "symfony/deprecation-contracts",
"type": "library",
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"license": "MIT",
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"require": {
"php": ">=7.1"
},
"autoload": {
"files": [
"function.php"
]
},
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-main": "2.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
}
}

View File

@ -0,0 +1,27 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
if (!function_exists('trigger_deprecation')) {
/**
* Triggers a silenced deprecation notice.
*
* @param string $package The name of the Composer package that is triggering the deprecation
* @param string $version The version of the package that introduced the deprecation
* @param string $message The message of the deprecation
* @param mixed ...$args Values to insert in the message using printf() formatting
*
* @author Nicolas Grekas <p@tchwork.com>
*/
function trigger_deprecation(string $package, string $version, string $message, ...$args): void
{
@trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED);
}
}

View File

@ -1,11 +1,6 @@
CHANGELOG CHANGELOG
========= =========
6.0
---
* Remove `Comparator::setTarget()` and `Comparator::setOperator()`
5.4.0 5.4.0
----- -----

View File

@ -0,0 +1,117 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Finder\Comparator;
/**
* @author Fabien Potencier <fabien@symfony.com>
*/
class Comparator
{
private $target;
private $operator = '==';
public function __construct(string $target = null, string $operator = '==')
{
if (null === $target) {
trigger_deprecation('symfony/finder', '5.4', 'Constructing a "%s" without setting "$target" is deprecated.', __CLASS__);
}
$this->target = $target;
$this->doSetOperator($operator);
}
/**
* Gets the target value.
*
* @return string
*/
public function getTarget()
{
if (null === $this->target) {
trigger_deprecation('symfony/finder', '5.4', 'Calling "%s" without initializing the target is deprecated.', __METHOD__);
}
return $this->target;
}
/**
* @deprecated set the target via the constructor instead
*/
public function setTarget(string $target)
{
trigger_deprecation('symfony/finder', '5.4', '"%s" is deprecated. Set the target via the constructor instead.', __METHOD__);
$this->target = $target;
}
/**
* Gets the comparison operator.
*
* @return string
*/
public function getOperator()
{
return $this->operator;
}
/**
* Sets the comparison operator.
*
* @throws \InvalidArgumentException
*
* @deprecated set the operator via the constructor instead
*/
public function setOperator(string $operator)
{
trigger_deprecation('symfony/finder', '5.4', '"%s" is deprecated. Set the operator via the constructor instead.', __METHOD__);
$this->doSetOperator('' === $operator ? '==' : $operator);
}
/**
* Tests against the target.
*
* @param mixed $test A test value
*
* @return bool
*/
public function test($test)
{
if (null === $this->target) {
trigger_deprecation('symfony/finder', '5.4', 'Calling "%s" without initializing the target is deprecated.', __METHOD__);
}
switch ($this->operator) {
case '>':
return $test > $this->target;
case '>=':
return $test >= $this->target;
case '<':
return $test < $this->target;
case '<=':
return $test <= $this->target;
case '!=':
return $test != $this->target;
}
return $test == $this->target;
}
private function doSetOperator(string $operator): void
{
if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) {
throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
}
$this->operator = $operator;
}
}

View File

@ -45,27 +45,27 @@ class Finder implements \IteratorAggregate, \Countable
public const IGNORE_DOT_FILES = 2; public const IGNORE_DOT_FILES = 2;
public const IGNORE_VCS_IGNORED_FILES = 4; public const IGNORE_VCS_IGNORED_FILES = 4;
private int $mode = 0; private $mode = 0;
private array $names = []; private $names = [];
private array $notNames = []; private $notNames = [];
private array $exclude = []; private $exclude = [];
private array $filters = []; private $filters = [];
private array $depths = []; private $depths = [];
private array $sizes = []; private $sizes = [];
private bool $followLinks = false; private $followLinks = false;
private bool $reverseSorting = false; private $reverseSorting = false;
private \Closure|int|false $sort = false; private $sort = false;
private int $ignore = 0; private $ignore = 0;
private array $dirs = []; private $dirs = [];
private array $dates = []; private $dates = [];
private array $iterators = []; private $iterators = [];
private array $contains = []; private $contains = [];
private array $notContains = []; private $notContains = [];
private array $paths = []; private $paths = [];
private array $notPaths = []; private $notPaths = [];
private bool $ignoreUnreadableDirs = false; private $ignoreUnreadableDirs = false;
private static array $vcsPatterns = ['.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg']; private static $vcsPatterns = ['.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg'];
public function __construct() public function __construct()
{ {
@ -74,8 +74,10 @@ class Finder implements \IteratorAggregate, \Countable
/** /**
* Creates a new Finder. * Creates a new Finder.
*
* @return static
*/ */
public static function create(): static public static function create()
{ {
return new static(); return new static();
} }
@ -85,7 +87,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @return $this * @return $this
*/ */
public function directories(): static public function directories()
{ {
$this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES; $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
@ -97,7 +99,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @return $this * @return $this
*/ */
public function files(): static public function files()
{ {
$this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES; $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
@ -120,7 +122,7 @@ class Finder implements \IteratorAggregate, \Countable
* @see DepthRangeFilterIterator * @see DepthRangeFilterIterator
* @see NumberComparator * @see NumberComparator
*/ */
public function depth(string|int|array $levels): static public function depth($levels)
{ {
foreach ((array) $levels as $level) { foreach ((array) $levels as $level) {
$this->depths[] = new Comparator\NumberComparator($level); $this->depths[] = new Comparator\NumberComparator($level);
@ -148,7 +150,7 @@ class Finder implements \IteratorAggregate, \Countable
* @see DateRangeFilterIterator * @see DateRangeFilterIterator
* @see DateComparator * @see DateComparator
*/ */
public function date(string|array $dates): static public function date($dates)
{ {
foreach ((array) $dates as $date) { foreach ((array) $dates as $date) {
$this->dates[] = new Comparator\DateComparator($date); $this->dates[] = new Comparator\DateComparator($date);
@ -173,7 +175,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @see FilenameFilterIterator * @see FilenameFilterIterator
*/ */
public function name(string|array $patterns): static public function name($patterns)
{ {
$this->names = array_merge($this->names, (array) $patterns); $this->names = array_merge($this->names, (array) $patterns);
@ -189,7 +191,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @see FilenameFilterIterator * @see FilenameFilterIterator
*/ */
public function notName(string|array $patterns): static public function notName($patterns)
{ {
$this->notNames = array_merge($this->notNames, (array) $patterns); $this->notNames = array_merge($this->notNames, (array) $patterns);
@ -211,7 +213,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @see FilecontentFilterIterator * @see FilecontentFilterIterator
*/ */
public function contains(string|array $patterns): static public function contains($patterns)
{ {
$this->contains = array_merge($this->contains, (array) $patterns); $this->contains = array_merge($this->contains, (array) $patterns);
@ -233,7 +235,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @see FilecontentFilterIterator * @see FilecontentFilterIterator
*/ */
public function notContains(string|array $patterns): static public function notContains($patterns)
{ {
$this->notContains = array_merge($this->notContains, (array) $patterns); $this->notContains = array_merge($this->notContains, (array) $patterns);
@ -257,7 +259,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @see FilenameFilterIterator * @see FilenameFilterIterator
*/ */
public function path(string|array $patterns): static public function path($patterns)
{ {
$this->paths = array_merge($this->paths, (array) $patterns); $this->paths = array_merge($this->paths, (array) $patterns);
@ -281,7 +283,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @see FilenameFilterIterator * @see FilenameFilterIterator
*/ */
public function notPath(string|array $patterns): static public function notPath($patterns)
{ {
$this->notPaths = array_merge($this->notPaths, (array) $patterns); $this->notPaths = array_merge($this->notPaths, (array) $patterns);
@ -303,7 +305,7 @@ class Finder implements \IteratorAggregate, \Countable
* @see SizeRangeFilterIterator * @see SizeRangeFilterIterator
* @see NumberComparator * @see NumberComparator
*/ */
public function size(string|int|array $sizes): static public function size($sizes)
{ {
foreach ((array) $sizes as $size) { foreach ((array) $sizes as $size) {
$this->sizes[] = new Comparator\NumberComparator($size); $this->sizes[] = new Comparator\NumberComparator($size);
@ -325,7 +327,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @see ExcludeDirectoryFilterIterator * @see ExcludeDirectoryFilterIterator
*/ */
public function exclude(string|array $dirs): static public function exclude($dirs)
{ {
$this->exclude = array_merge($this->exclude, (array) $dirs); $this->exclude = array_merge($this->exclude, (array) $dirs);
@ -341,7 +343,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @see ExcludeDirectoryFilterIterator * @see ExcludeDirectoryFilterIterator
*/ */
public function ignoreDotFiles(bool $ignoreDotFiles): static public function ignoreDotFiles(bool $ignoreDotFiles)
{ {
if ($ignoreDotFiles) { if ($ignoreDotFiles) {
$this->ignore |= static::IGNORE_DOT_FILES; $this->ignore |= static::IGNORE_DOT_FILES;
@ -361,7 +363,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @see ExcludeDirectoryFilterIterator * @see ExcludeDirectoryFilterIterator
*/ */
public function ignoreVCS(bool $ignoreVCS): static public function ignoreVCS(bool $ignoreVCS)
{ {
if ($ignoreVCS) { if ($ignoreVCS) {
$this->ignore |= static::IGNORE_VCS_FILES; $this->ignore |= static::IGNORE_VCS_FILES;
@ -379,7 +381,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @return $this * @return $this
*/ */
public function ignoreVCSIgnored(bool $ignoreVCSIgnored): static public function ignoreVCSIgnored(bool $ignoreVCSIgnored)
{ {
if ($ignoreVCSIgnored) { if ($ignoreVCSIgnored) {
$this->ignore |= static::IGNORE_VCS_IGNORED_FILES; $this->ignore |= static::IGNORE_VCS_IGNORED_FILES;
@ -397,7 +399,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @param string|string[] $pattern VCS patterns to ignore * @param string|string[] $pattern VCS patterns to ignore
*/ */
public static function addVCSPattern(string|array $pattern) public static function addVCSPattern($pattern)
{ {
foreach ((array) $pattern as $p) { foreach ((array) $pattern as $p) {
self::$vcsPatterns[] = $p; self::$vcsPatterns[] = $p;
@ -417,7 +419,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @see SortableIterator * @see SortableIterator
*/ */
public function sort(\Closure $closure): static public function sort(\Closure $closure)
{ {
$this->sort = $closure; $this->sort = $closure;
@ -433,7 +435,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @see SortableIterator * @see SortableIterator
*/ */
public function sortByName(bool $useNaturalSort = false): static public function sortByName(bool $useNaturalSort = false)
{ {
$this->sort = $useNaturalSort ? Iterator\SortableIterator::SORT_BY_NAME_NATURAL : Iterator\SortableIterator::SORT_BY_NAME; $this->sort = $useNaturalSort ? Iterator\SortableIterator::SORT_BY_NAME_NATURAL : Iterator\SortableIterator::SORT_BY_NAME;
@ -449,7 +451,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @see SortableIterator * @see SortableIterator
*/ */
public function sortByType(): static public function sortByType()
{ {
$this->sort = Iterator\SortableIterator::SORT_BY_TYPE; $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
@ -467,7 +469,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @see SortableIterator * @see SortableIterator
*/ */
public function sortByAccessedTime(): static public function sortByAccessedTime()
{ {
$this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME; $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
@ -479,7 +481,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @return $this * @return $this
*/ */
public function reverseSorting(): static public function reverseSorting()
{ {
$this->reverseSorting = true; $this->reverseSorting = true;
@ -499,7 +501,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @see SortableIterator * @see SortableIterator
*/ */
public function sortByChangedTime(): static public function sortByChangedTime()
{ {
$this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME; $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
@ -517,7 +519,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @see SortableIterator * @see SortableIterator
*/ */
public function sortByModifiedTime(): static public function sortByModifiedTime()
{ {
$this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME; $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
@ -534,7 +536,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @see CustomFilterIterator * @see CustomFilterIterator
*/ */
public function filter(\Closure $closure): static public function filter(\Closure $closure)
{ {
$this->filters[] = $closure; $this->filters[] = $closure;
@ -546,7 +548,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @return $this * @return $this
*/ */
public function followLinks(): static public function followLinks()
{ {
$this->followLinks = true; $this->followLinks = true;
@ -560,7 +562,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @return $this * @return $this
*/ */
public function ignoreUnreadableDirs(bool $ignore = true): static public function ignoreUnreadableDirs(bool $ignore = true)
{ {
$this->ignoreUnreadableDirs = $ignore; $this->ignoreUnreadableDirs = $ignore;
@ -576,7 +578,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @throws DirectoryNotFoundException if one of the directories does not exist * @throws DirectoryNotFoundException if one of the directories does not exist
*/ */
public function in(string|array $dirs): static public function in($dirs)
{ {
$resolvedDirs = []; $resolvedDirs = [];
@ -605,7 +607,8 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @throws \LogicException if the in() method has not been called * @throws \LogicException if the in() method has not been called
*/ */
public function getIterator(): \Iterator #[\ReturnTypeWillChange]
public function getIterator()
{ {
if (0 === \count($this->dirs) && 0 === \count($this->iterators)) { if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.'); throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
@ -648,7 +651,7 @@ class Finder implements \IteratorAggregate, \Countable
* *
* @throws \InvalidArgumentException when the given argument is not iterable * @throws \InvalidArgumentException when the given argument is not iterable
*/ */
public function append(iterable $iterator): static public function append(iterable $iterator)
{ {
if ($iterator instanceof \IteratorAggregate) { if ($iterator instanceof \IteratorAggregate) {
$this->iterators[] = $iterator->getIterator(); $this->iterators[] = $iterator->getIterator();
@ -670,8 +673,10 @@ class Finder implements \IteratorAggregate, \Countable
/** /**
* Check if any results were found. * Check if any results were found.
*
* @return bool
*/ */
public function hasResults(): bool public function hasResults()
{ {
foreach ($this->getIterator() as $_) { foreach ($this->getIterator() as $_) {
return true; return true;
@ -682,8 +687,11 @@ class Finder implements \IteratorAggregate, \Countable
/** /**
* Counts all the results collected by the iterators. * Counts all the results collected by the iterators.
*
* @return int
*/ */
public function count(): int #[\ReturnTypeWillChange]
public function count()
{ {
return iterator_count($this->getIterator()); return iterator_count($this->getIterator());
} }

View File

@ -37,8 +37,10 @@ class Glob
{ {
/** /**
* Returns a regexp which is the equivalent of the glob pattern. * Returns a regexp which is the equivalent of the glob pattern.
*
* @return string
*/ */
public static function toRegex(string $glob, bool $strictLeadingDot = true, bool $strictWildcardSlash = true, string $delimiter = '#'): string public static function toRegex(string $glob, bool $strictLeadingDot = true, bool $strictWildcardSlash = true, string $delimiter = '#')
{ {
$firstByte = true; $firstByte = true;
$escaping = false; $escaping = false;

View File

@ -23,7 +23,7 @@ namespace Symfony\Component\Finder\Iterator;
*/ */
class CustomFilterIterator extends \FilterIterator class CustomFilterIterator extends \FilterIterator
{ {
private array $filters = []; private $filters = [];
/** /**
* @param \Iterator<string, \SplFileInfo> $iterator The Iterator to filter * @param \Iterator<string, \SplFileInfo> $iterator The Iterator to filter
@ -45,8 +45,11 @@ class CustomFilterIterator extends \FilterIterator
/** /**
* Filters the iterator values. * Filters the iterator values.
*
* @return bool
*/ */
public function accept(): bool #[\ReturnTypeWillChange]
public function accept()
{ {
$fileinfo = $this->current(); $fileinfo = $this->current();

View File

@ -22,7 +22,7 @@ use Symfony\Component\Finder\Comparator\DateComparator;
*/ */
class DateRangeFilterIterator extends \FilterIterator class DateRangeFilterIterator extends \FilterIterator
{ {
private array $comparators = []; private $comparators = [];
/** /**
* @param \Iterator<string, \SplFileInfo> $iterator * @param \Iterator<string, \SplFileInfo> $iterator
@ -37,8 +37,11 @@ class DateRangeFilterIterator extends \FilterIterator
/** /**
* Filters the iterator values. * Filters the iterator values.
*
* @return bool
*/ */
public function accept(): bool #[\ReturnTypeWillChange]
public function accept()
{ {
$fileinfo = $this->current(); $fileinfo = $this->current();

View File

@ -23,7 +23,7 @@ namespace Symfony\Component\Finder\Iterator;
*/ */
class DepthRangeFilterIterator extends \FilterIterator class DepthRangeFilterIterator extends \FilterIterator
{ {
private int $minDepth = 0; private $minDepth = 0;
/** /**
* @param \RecursiveIteratorIterator<\RecursiveIterator<TKey, TValue>> $iterator The Iterator to filter * @param \RecursiveIteratorIterator<\RecursiveIterator<TKey, TValue>> $iterator The Iterator to filter
@ -40,8 +40,11 @@ class DepthRangeFilterIterator extends \FilterIterator
/** /**
* Filters the iterator values. * Filters the iterator values.
*
* @return bool
*/ */
public function accept(): bool #[\ReturnTypeWillChange]
public function accept()
{ {
return $this->getInnerIterator()->getDepth() >= $this->minDepth; return $this->getInnerIterator()->getDepth() >= $this->minDepth;
} }

View File

@ -21,10 +21,10 @@ namespace Symfony\Component\Finder\Iterator;
*/ */
class ExcludeDirectoryFilterIterator extends \FilterIterator implements \RecursiveIterator class ExcludeDirectoryFilterIterator extends \FilterIterator implements \RecursiveIterator
{ {
private \Iterator $iterator; private $iterator;
private bool $isRecursive; private $isRecursive;
private array $excludedDirs = []; private $excludedDirs = [];
private ?string $excludedPattern = null; private $excludedPattern;
/** /**
* @param \Iterator $iterator The Iterator to filter * @param \Iterator $iterator The Iterator to filter
@ -52,8 +52,11 @@ class ExcludeDirectoryFilterIterator extends \FilterIterator implements \Recursi
/** /**
* Filters the iterator values. * Filters the iterator values.
*
* @return bool
*/ */
public function accept(): bool #[\ReturnTypeWillChange]
public function accept()
{ {
if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) { if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
return false; return false;
@ -69,12 +72,20 @@ class ExcludeDirectoryFilterIterator extends \FilterIterator implements \Recursi
return true; return true;
} }
public function hasChildren(): bool /**
* @return bool
*/
#[\ReturnTypeWillChange]
public function hasChildren()
{ {
return $this->isRecursive && $this->iterator->hasChildren(); return $this->isRecursive && $this->iterator->hasChildren();
} }
public function getChildren(): self /**
* @return self
*/
#[\ReturnTypeWillChange]
public function getChildren()
{ {
$children = new self($this->iterator->getChildren(), []); $children = new self($this->iterator->getChildren(), []);
$children->excludedDirs = $this->excludedDirs; $children->excludedDirs = $this->excludedDirs;

View File

@ -23,7 +23,7 @@ class FileTypeFilterIterator extends \FilterIterator
public const ONLY_FILES = 1; public const ONLY_FILES = 1;
public const ONLY_DIRECTORIES = 2; public const ONLY_DIRECTORIES = 2;
private int $mode; private $mode;
/** /**
* @param \Iterator $iterator The Iterator to filter * @param \Iterator $iterator The Iterator to filter
@ -38,8 +38,11 @@ class FileTypeFilterIterator extends \FilterIterator
/** /**
* Filters the iterator values. * Filters the iterator values.
*
* @return bool
*/ */
public function accept(): bool #[\ReturnTypeWillChange]
public function accept()
{ {
$fileinfo = $this->current(); $fileinfo = $this->current();
if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) { if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {

View File

@ -23,8 +23,11 @@ class FilecontentFilterIterator extends MultiplePcreFilterIterator
{ {
/** /**
* Filters the iterator values. * Filters the iterator values.
*
* @return bool
*/ */
public function accept(): bool #[\ReturnTypeWillChange]
public function accept()
{ {
if (!$this->matchRegexps && !$this->noMatchRegexps) { if (!$this->matchRegexps && !$this->noMatchRegexps) {
return true; return true;
@ -48,8 +51,10 @@ class FilecontentFilterIterator extends MultiplePcreFilterIterator
* Converts string to regexp if necessary. * Converts string to regexp if necessary.
* *
* @param string $str Pattern: string or regexp * @param string $str Pattern: string or regexp
*
* @return string
*/ */
protected function toRegex(string $str): string protected function toRegex(string $str)
{ {
return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/'; return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
} }

View File

@ -24,8 +24,11 @@ class FilenameFilterIterator extends MultiplePcreFilterIterator
{ {
/** /**
* Filters the iterator values. * Filters the iterator values.
*
* @return bool
*/ */
public function accept(): bool #[\ReturnTypeWillChange]
public function accept()
{ {
return $this->isAccepted($this->current()->getFilename()); return $this->isAccepted($this->current()->getFilename());
} }
@ -37,8 +40,10 @@ class FilenameFilterIterator extends MultiplePcreFilterIterator
* Glob strings are transformed with Glob::toRegex(). * Glob strings are transformed with Glob::toRegex().
* *
* @param string $str Pattern: glob or regexp * @param string $str Pattern: glob or regexp
*
* @return string
*/ */
protected function toRegex(string $str): string protected function toRegex(string $str)
{ {
return $this->isRegex($str) ? $str : Glob::toRegex($str); return $this->isRegex($str) ? $str : Glob::toRegex($str);
} }

View File

@ -18,11 +18,11 @@ namespace Symfony\Component\Finder\Iterator;
*/ */
class LazyIterator implements \IteratorAggregate class LazyIterator implements \IteratorAggregate
{ {
private \Closure $iteratorFactory; private $iteratorFactory;
public function __construct(callable $iteratorFactory) public function __construct(callable $iteratorFactory)
{ {
$this->iteratorFactory = $iteratorFactory instanceof \Closure ? $iteratorFactory : \Closure::fromCallable($iteratorFactory); $this->iteratorFactory = $iteratorFactory;
} }
public function getIterator(): \Traversable public function getIterator(): \Traversable

View File

@ -50,8 +50,10 @@ abstract class MultiplePcreFilterIterator extends \FilterIterator
* If there is no regexps defined in the class, this method will accept the string. * If there is no regexps defined in the class, this method will accept the string.
* Such case can be handled by child classes before calling the method if they want to * Such case can be handled by child classes before calling the method if they want to
* apply a different behavior. * apply a different behavior.
*
* @return bool
*/ */
protected function isAccepted(string $string): bool protected function isAccepted(string $string)
{ {
// should at least not match one rule to exclude // should at least not match one rule to exclude
foreach ($this->noMatchRegexps as $regex) { foreach ($this->noMatchRegexps as $regex) {
@ -77,10 +79,18 @@ abstract class MultiplePcreFilterIterator extends \FilterIterator
/** /**
* Checks whether the string is a regex. * Checks whether the string is a regex.
*
* @return bool
*/ */
protected function isRegex(string $str): bool protected function isRegex(string $str)
{ {
if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) { $availableModifiers = 'imsxuADU';
if (\PHP_VERSION_ID >= 80200) {
$availableModifiers .= 'n';
}
if (preg_match('/^(.{3,}?)['.$availableModifiers.']*$/', $str, $m)) {
$start = substr($m[1], 0, 1); $start = substr($m[1], 0, 1);
$end = substr($m[1], -1); $end = substr($m[1], -1);
@ -100,6 +110,8 @@ abstract class MultiplePcreFilterIterator extends \FilterIterator
/** /**
* Converts string into regexp. * Converts string into regexp.
*
* @return string
*/ */
abstract protected function toRegex(string $str): string; abstract protected function toRegex(string $str);
} }

View File

@ -23,8 +23,11 @@ class PathFilterIterator extends MultiplePcreFilterIterator
{ {
/** /**
* Filters the iterator values. * Filters the iterator values.
*
* @return bool
*/ */
public function accept(): bool #[\ReturnTypeWillChange]
public function accept()
{ {
$filename = $this->current()->getRelativePathname(); $filename = $this->current()->getRelativePathname();
@ -46,8 +49,10 @@ class PathFilterIterator extends MultiplePcreFilterIterator
* Use only / as directory separator (on Windows also). * Use only / as directory separator (on Windows also).
* *
* @param string $str Pattern: regexp or dirname * @param string $str Pattern: regexp or dirname
*
* @return string
*/ */
protected function toRegex(string $str): string protected function toRegex(string $str)
{ {
return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/'; return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
} }

View File

@ -21,13 +21,20 @@ use Symfony\Component\Finder\SplFileInfo;
*/ */
class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
{ {
private bool $ignoreUnreadableDirs; /**
private ?bool $rewindable = null; * @var bool
*/
private $ignoreUnreadableDirs;
/**
* @var bool
*/
private $rewindable;
// these 3 properties take part of the performance optimization to avoid redoing the same work in all iterations // these 3 properties take part of the performance optimization to avoid redoing the same work in all iterations
private string $rootPath; private $rootPath;
private string $subPath; private $subPath;
private string $directorySeparator = '/'; private $directorySeparator = '/';
/** /**
* @throws \RuntimeException * @throws \RuntimeException
@ -48,15 +55,17 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
/** /**
* Return an instance of SplFileInfo with support for relative paths. * Return an instance of SplFileInfo with support for relative paths.
*
* @return SplFileInfo
*/ */
public function current(): SplFileInfo #[\ReturnTypeWillChange]
public function current()
{ {
// the logic here avoids redoing the same work in all iterations // the logic here avoids redoing the same work in all iterations
if (!isset($this->subPath)) { if (null === $subPathname = $this->subPath) {
$this->subPath = $this->getSubPath(); $subPathname = $this->subPath = $this->getSubPath();
} }
$subPathname = $this->subPath;
if ('' !== $subPathname) { if ('' !== $subPathname) {
$subPathname .= $this->directorySeparator; $subPathname .= $this->directorySeparator;
} }
@ -69,7 +78,13 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
return new SplFileInfo($basePath.$subPathname, $this->subPath, $subPathname); return new SplFileInfo($basePath.$subPathname, $this->subPath, $subPathname);
} }
public function hasChildren(bool $allowLinks = false): bool /**
* @param bool $allowLinks
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function hasChildren($allowLinks = false)
{ {
$hasChildren = parent::hasChildren($allowLinks); $hasChildren = parent::hasChildren($allowLinks);
@ -88,9 +103,12 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
} }
/** /**
* @return \RecursiveDirectoryIterator
*
* @throws AccessDeniedException * @throws AccessDeniedException
*/ */
public function getChildren(): \RecursiveDirectoryIterator #[\ReturnTypeWillChange]
public function getChildren()
{ {
try { try {
$children = parent::getChildren(); $children = parent::getChildren();
@ -112,8 +130,11 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
/** /**
* Do nothing for non rewindable stream. * Do nothing for non rewindable stream.
*
* @return void
*/ */
public function rewind(): void #[\ReturnTypeWillChange]
public function rewind()
{ {
if (false === $this->isRewindable()) { if (false === $this->isRewindable()) {
return; return;
@ -124,8 +145,10 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
/** /**
* Checks if the stream is rewindable. * Checks if the stream is rewindable.
*
* @return bool
*/ */
public function isRewindable(): bool public function isRewindable()
{ {
if (null !== $this->rewindable) { if (null !== $this->rewindable) {
return $this->rewindable; return $this->rewindable;

View File

@ -22,7 +22,7 @@ use Symfony\Component\Finder\Comparator\NumberComparator;
*/ */
class SizeRangeFilterIterator extends \FilterIterator class SizeRangeFilterIterator extends \FilterIterator
{ {
private array $comparators = []; private $comparators = [];
/** /**
* @param \Iterator<string, \SplFileInfo> $iterator * @param \Iterator<string, \SplFileInfo> $iterator
@ -37,8 +37,11 @@ class SizeRangeFilterIterator extends \FilterIterator
/** /**
* Filters the iterator values. * Filters the iterator values.
*
* @return bool
*/ */
public function accept(): bool #[\ReturnTypeWillChange]
public function accept()
{ {
$fileinfo = $this->current(); $fileinfo = $this->current();
if (!$fileinfo->isFile()) { if (!$fileinfo->isFile()) {

View File

@ -28,8 +28,8 @@ class SortableIterator implements \IteratorAggregate
public const SORT_BY_MODIFIED_TIME = 5; public const SORT_BY_MODIFIED_TIME = 5;
public const SORT_BY_NAME_NATURAL = 6; public const SORT_BY_NAME_NATURAL = 6;
private \Traversable $iterator; private $iterator;
private \Closure|int $sort; private $sort;
/** /**
* @param \Traversable<string, \SplFileInfo> $iterator * @param \Traversable<string, \SplFileInfo> $iterator
@ -37,7 +37,7 @@ class SortableIterator implements \IteratorAggregate
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function __construct(\Traversable $iterator, int|callable $sort, bool $reverseOrder = false) public function __construct(\Traversable $iterator, $sort, bool $reverseOrder = false)
{ {
$this->iterator = $iterator; $this->iterator = $iterator;
$order = $reverseOrder ? -1 : 1; $order = $reverseOrder ? -1 : 1;
@ -75,13 +75,17 @@ class SortableIterator implements \IteratorAggregate
} elseif (self::SORT_BY_NONE === $sort) { } elseif (self::SORT_BY_NONE === $sort) {
$this->sort = $order; $this->sort = $order;
} elseif (\is_callable($sort)) { } elseif (\is_callable($sort)) {
$this->sort = $reverseOrder ? static function (\SplFileInfo $a, \SplFileInfo $b) use ($sort) { return -$sort($a, $b); } : \Closure::fromCallable($sort); $this->sort = $reverseOrder ? static function (\SplFileInfo $a, \SplFileInfo $b) use ($sort) { return -$sort($a, $b); } : $sort;
} else { } else {
throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.'); throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
} }
} }
public function getIterator(): \Traversable /**
* @return \Traversable<string, \SplFileInfo>
*/
#[\ReturnTypeWillChange]
public function getIterator()
{ {
if (1 === $this->sort) { if (1 === $this->sort) {
return $this->iterator; return $this->iterator;

View File

@ -18,8 +18,8 @@ namespace Symfony\Component\Finder;
*/ */
class SplFileInfo extends \SplFileInfo class SplFileInfo extends \SplFileInfo
{ {
private string $relativePath; private $relativePath;
private string $relativePathname; private $relativePathname;
/** /**
* @param string $file The file name * @param string $file The file name
@ -37,8 +37,10 @@ class SplFileInfo extends \SplFileInfo
* Returns the relative path. * Returns the relative path.
* *
* This path does not contain the file name. * This path does not contain the file name.
*
* @return string
*/ */
public function getRelativePath(): string public function getRelativePath()
{ {
return $this->relativePath; return $this->relativePath;
} }
@ -47,8 +49,10 @@ class SplFileInfo extends \SplFileInfo
* Returns the relative path name. * Returns the relative path name.
* *
* This path contains the file name. * This path contains the file name.
*
* @return string
*/ */
public function getRelativePathname(): string public function getRelativePathname()
{ {
return $this->relativePathname; return $this->relativePathname;
} }
@ -63,9 +67,11 @@ class SplFileInfo extends \SplFileInfo
/** /**
* Returns the contents of the file. * Returns the contents of the file.
* *
* @return string
*
* @throws \RuntimeException * @throws \RuntimeException
*/ */
public function getContents(): string public function getContents()
{ {
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; }); set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
try { try {

View File

@ -16,7 +16,9 @@
} }
], ],
"require": { "require": {
"php": ">=8.0.2" "php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1|^3",
"symfony/polyfill-php80": "^1.16"
}, },
"autoload": { "autoload": {
"psr-4": { "Symfony\\Component\\Finder\\": "" }, "psr-4": { "Symfony\\Component\\Finder\\": "" },

View File

@ -0,0 +1,19 @@
Copyright (c) 2020 Fabien Potencier
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.

View File

@ -0,0 +1,115 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Polyfill\Php80;
/**
* @author Ion Bazan <ion.bazan@gmail.com>
* @author Nico Oelgart <nicoswd@gmail.com>
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
final class Php80
{
public static function fdiv(float $dividend, float $divisor): float
{
return @($dividend / $divisor);
}
public static function get_debug_type($value): string
{
switch (true) {
case null === $value: return 'null';
case \is_bool($value): return 'bool';
case \is_string($value): return 'string';
case \is_array($value): return 'array';
case \is_int($value): return 'int';
case \is_float($value): return 'float';
case \is_object($value): break;
case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
default:
if (null === $type = @get_resource_type($value)) {
return 'unknown';
}
if ('Unknown' === $type) {
$type = 'closed';
}
return "resource ($type)";
}
$class = \get_class($value);
if (false === strpos($class, '@')) {
return $class;
}
return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous';
}
public static function get_resource_id($res): int
{
if (!\is_resource($res) && null === @get_resource_type($res)) {
throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res)));
}
return (int) $res;
}
public static function preg_last_error_msg(): string
{
switch (preg_last_error()) {
case \PREG_INTERNAL_ERROR:
return 'Internal error';
case \PREG_BAD_UTF8_ERROR:
return 'Malformed UTF-8 characters, possibly incorrectly encoded';
case \PREG_BAD_UTF8_OFFSET_ERROR:
return 'The offset did not correspond to the beginning of a valid UTF-8 code point';
case \PREG_BACKTRACK_LIMIT_ERROR:
return 'Backtrack limit exhausted';
case \PREG_RECURSION_LIMIT_ERROR:
return 'Recursion limit exhausted';
case \PREG_JIT_STACKLIMIT_ERROR:
return 'JIT stack limit exhausted';
case \PREG_NO_ERROR:
return 'No error';
default:
return 'Unknown error';
}
}
public static function str_contains(string $haystack, string $needle): bool
{
return '' === $needle || false !== strpos($haystack, $needle);
}
public static function str_starts_with(string $haystack, string $needle): bool
{
return 0 === strncmp($haystack, $needle, \strlen($needle));
}
public static function str_ends_with(string $haystack, string $needle): bool
{
if ('' === $needle || $needle === $haystack) {
return true;
}
if ('' === $haystack) {
return false;
}
$needleLength = \strlen($needle);
return $needleLength <= \strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength);
}
}

View File

@ -0,0 +1,103 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Polyfill\Php80;
/**
* @author Fedonyuk Anton <info@ensostudio.ru>
*
* @internal
*/
class PhpToken implements \Stringable
{
/**
* @var int
*/
public $id;
/**
* @var string
*/
public $text;
/**
* @var int
*/
public $line;
/**
* @var int
*/
public $pos;
public function __construct(int $id, string $text, int $line = -1, int $position = -1)
{
$this->id = $id;
$this->text = $text;
$this->line = $line;
$this->pos = $position;
}
public function getTokenName(): ?string
{
if ('UNKNOWN' === $name = token_name($this->id)) {
$name = \strlen($this->text) > 1 || \ord($this->text) < 32 ? null : $this->text;
}
return $name;
}
/**
* @param int|string|array $kind
*/
public function is($kind): bool
{
foreach ((array) $kind as $value) {
if (\in_array($value, [$this->id, $this->text], true)) {
return true;
}
}
return false;
}
public function isIgnorable(): bool
{
return \in_array($this->id, [\T_WHITESPACE, \T_COMMENT, \T_DOC_COMMENT, \T_OPEN_TAG], true);
}
public function __toString(): string
{
return (string) $this->text;
}
/**
* @return static[]
*/
public static function tokenize(string $code, int $flags = 0): array
{
$line = 1;
$position = 0;
$tokens = token_get_all($code, $flags);
foreach ($tokens as $index => $token) {
if (\is_string($token)) {
$id = \ord($token);
$text = $token;
} else {
[$id, $text, $line] = $token;
}
$tokens[$index] = new static($id, $text, $line, $position);
$position += \strlen($text);
}
return $tokens;
}
}

View File

@ -0,0 +1,25 @@
Symfony Polyfill / Php80
========================
This component provides features added to PHP 8.0 core:
- [`Stringable`](https://php.net/stringable) interface
- [`fdiv`](https://php.net/fdiv)
- [`ValueError`](https://php.net/valueerror) class
- [`UnhandledMatchError`](https://php.net/unhandledmatcherror) class
- `FILTER_VALIDATE_BOOL` constant
- [`get_debug_type`](https://php.net/get_debug_type)
- [`PhpToken`](https://php.net/phptoken) class
- [`preg_last_error_msg`](https://php.net/preg_last_error_msg)
- [`str_contains`](https://php.net/str_contains)
- [`str_starts_with`](https://php.net/str_starts_with)
- [`str_ends_with`](https://php.net/str_ends_with)
- [`get_resource_id`](https://php.net/get_resource_id)
More information can be found in the
[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md).
License
=======
This library is released under the [MIT license](LICENSE).

View File

@ -0,0 +1,22 @@
<?php
#[Attribute(Attribute::TARGET_CLASS)]
final class Attribute
{
public const TARGET_CLASS = 1;
public const TARGET_FUNCTION = 2;
public const TARGET_METHOD = 4;
public const TARGET_PROPERTY = 8;
public const TARGET_CLASS_CONSTANT = 16;
public const TARGET_PARAMETER = 32;
public const TARGET_ALL = 63;
public const IS_REPEATABLE = 64;
/** @var int */
public $flags;
public function __construct(int $flags = self::TARGET_ALL)
{
$this->flags = $flags;
}
}

View File

@ -0,0 +1,7 @@
<?php
if (\PHP_VERSION_ID < 80000 && \extension_loaded('tokenizer')) {
class PhpToken extends Symfony\Polyfill\Php80\PhpToken
{
}
}

View File

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

View File

@ -0,0 +1,7 @@
<?php
if (\PHP_VERSION_ID < 80000) {
class UnhandledMatchError extends Error
{
}
}

View File

@ -0,0 +1,7 @@
<?php
if (\PHP_VERSION_ID < 80000) {
class ValueError extends Error
{
}
}

View File

@ -0,0 +1,42 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Polyfill\Php80 as p;
if (\PHP_VERSION_ID >= 80000) {
return;
}
if (!defined('FILTER_VALIDATE_BOOL') && defined('FILTER_VALIDATE_BOOLEAN')) {
define('FILTER_VALIDATE_BOOL', \FILTER_VALIDATE_BOOLEAN);
}
if (!function_exists('fdiv')) {
function fdiv(float $num1, float $num2): float { return p\Php80::fdiv($num1, $num2); }
}
if (!function_exists('preg_last_error_msg')) {
function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); }
}
if (!function_exists('str_contains')) {
function str_contains(?string $haystack, ?string $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); }
}
if (!function_exists('str_starts_with')) {
function str_starts_with(?string $haystack, ?string $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); }
}
if (!function_exists('str_ends_with')) {
function str_ends_with(?string $haystack, ?string $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); }
}
if (!function_exists('get_debug_type')) {
function get_debug_type($value): string { return p\Php80::get_debug_type($value); }
}
if (!function_exists('get_resource_id')) {
function get_resource_id($resource): int { return p\Php80::get_resource_id($resource); }
}

View File

@ -0,0 +1,40 @@
{
"name": "symfony/polyfill-php80",
"type": "library",
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
"keywords": ["polyfill", "shim", "compatibility", "portable"],
"homepage": "https://symfony.com",
"license": "MIT",
"authors": [
{
"name": "Ion Bazan",
"email": "ion.bazan@gmail.com"
},
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"require": {
"php": ">=7.1"
},
"autoload": {
"psr-4": { "Symfony\\Polyfill\\Php80\\": "" },
"files": [ "bootstrap.php" ],
"classmap": [ "Resources/stubs" ]
},
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-main": "1.26-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
}
}

View File

@ -1,5 +0,0 @@
{
"require": {
"gregwar/captcha": "1.*"
}
}

View File

@ -1,6 +1,6 @@
<?php <?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/app/vendor/autoload.php';
require $_SERVER['DOCUMENT_ROOT'] . '/app/libs/uoj-lib.php'; require $_SERVER['DOCUMENT_ROOT'] . '/app/libs/uoj-lib.php';
require UOJContext::documentRoot().'/app/route.php'; require UOJContext::documentRoot().'/app/route.php';

View File

@ -1,237 +0,0 @@
<?php
namespace Composer;
use Composer\Semver\VersionParser;
class InstalledVersions
{
private static $installed = array (
'root' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
),
'reference' => '0d931e270b425b35fabb421ea21043ba2aaf9786',
'name' => '__root__',
),
'versions' =>
array (
'__root__' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
),
'reference' => '0d931e270b425b35fabb421ea21043ba2aaf9786',
),
'gregwar/captcha' =>
array (
'pretty_version' => 'v1.1.9',
'version' => '1.1.9.0',
'aliases' =>
array (
),
'reference' => '4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5',
),
'symfony/finder' =>
array (
'pretty_version' => 'v6.0.3',
'version' => '6.0.3.0',
'aliases' =>
array (
),
'reference' => '8661b74dbabc23223f38c9b99d3f8ade71170430',
),
),
);
public static function getInstalledPackages()
{
return array_keys(self::$installed['versions']);
}
public static function isInstalled($packageName)
{
return isset(self::$installed['versions'][$packageName]);
}
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
public static function getVersionRanges($packageName)
{
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
$ranges = array();
if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
public static function getVersion($packageName)
{
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
if (!isset(self::$installed['versions'][$packageName]['version'])) {
return null;
}
return self::$installed['versions'][$packageName]['version'];
}
public static function getPrettyVersion($packageName)
{
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return self::$installed['versions'][$packageName]['pretty_version'];
}
public static function getReference($packageName)
{
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
if (!isset(self::$installed['versions'][$packageName]['reference'])) {
return null;
}
return self::$installed['versions'][$packageName]['reference'];
}
public static function getRootPackage()
{
return self::$installed['root'];
}
public static function getRawData()
{
return self::$installed;
}
public static function reload($data)
{
self::$installed = $data;
}
}

View File

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

View File

@ -1,44 +0,0 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInite9f59116cb3d815416daaf015687f2ec
{
public static $prefixLengthsPsr4 = array (
'S' =>
array (
'Symfony\\Component\\Finder\\' => 25,
),
'G' =>
array (
'Gregwar\\' => 8,
),
);
public static $prefixDirsPsr4 = array (
'Symfony\\Component\\Finder\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/finder',
),
'Gregwar\\' =>
array (
0 => __DIR__ . '/..' . '/gregwar/captcha/src/Gregwar',
),
);
public static $classMap = array (
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInite9f59116cb3d815416daaf015687f2ec::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInite9f59116cb3d815416daaf015687f2ec::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInite9f59116cb3d815416daaf015687f2ec::$classMap;
}, null, ClassLoader::class);
}
}

View File

@ -1,130 +0,0 @@
{
"packages": [
{
"name": "gregwar/captcha",
"version": "v1.1.9",
"version_normalized": "1.1.9.0",
"source": {
"type": "git",
"url": "https://github.com/Gregwar/Captcha.git",
"reference": "4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Gregwar/Captcha/zipball/4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5",
"reference": "4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5",
"shasum": ""
},
"require": {
"ext-gd": "*",
"ext-mbstring": "*",
"php": ">=5.3.0",
"symfony/finder": "*"
},
"require-dev": {
"phpunit/phpunit": "^6.4"
},
"time": "2020-03-24T14:39:05+00:00",
"type": "captcha",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Gregwar\\": "src/Gregwar"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Grégoire Passault",
"email": "g.passault@gmail.com",
"homepage": "http://www.gregwar.com/"
},
{
"name": "Jeremy Livingston",
"email": "jeremy.j.livingston@gmail.com"
}
],
"description": "Captcha generator",
"homepage": "https://github.com/Gregwar/Captcha",
"keywords": [
"bot",
"captcha",
"spam"
],
"support": {
"issues": "https://github.com/Gregwar/Captcha/issues",
"source": "https://github.com/Gregwar/Captcha/tree/master"
},
"install-path": "../gregwar/captcha"
},
{
"name": "symfony/finder",
"version": "v6.0.3",
"version_normalized": "6.0.3.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "8661b74dbabc23223f38c9b99d3f8ade71170430"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/8661b74dbabc23223f38c9b99d3f8ade71170430",
"reference": "8661b74dbabc23223f38c9b99d3f8ade71170430",
"shasum": ""
},
"require": {
"php": ">=8.0.2"
},
"time": "2022-01-26T17:23:29+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\Finder\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v6.0.3"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/finder"
}
],
"dev": true,
"dev-package-names": []
}

View File

@ -1,42 +0,0 @@
<?php return array (
'root' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
),
'reference' => '0d931e270b425b35fabb421ea21043ba2aaf9786',
'name' => '__root__',
),
'versions' =>
array (
'__root__' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
),
'reference' => '0d931e270b425b35fabb421ea21043ba2aaf9786',
),
'gregwar/captcha' =>
array (
'pretty_version' => 'v1.1.9',
'version' => '1.1.9.0',
'aliases' =>
array (
),
'reference' => '4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5',
),
'symfony/finder' =>
array (
'pretty_version' => 'v6.0.3',
'version' => '6.0.3.0',
'aliases' =>
array (
),
'reference' => '8661b74dbabc23223f38c9b99d3f8ade71170430',
),
),
);

View File

@ -1,68 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Finder\Comparator;
/**
* @author Fabien Potencier <fabien@symfony.com>
*/
class Comparator
{
private string $target;
private string $operator;
public function __construct(string $target, string $operator = '==')
{
if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) {
throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
}
$this->target = $target;
$this->operator = $operator;
}
/**
* Gets the target value.
*/
public function getTarget(): string
{
return $this->target;
}
/**
* Gets the comparison operator.
*/
public function getOperator(): string
{
return $this->operator;
}
/**
* Tests against the target.
*/
public function test(mixed $test): bool
{
switch ($this->operator) {
case '>':
return $test > $this->target;
case '>=':
return $test >= $this->target;
case '<':
return $test < $this->target;
case '<=':
return $test <= $this->target;
case '!=':
return $test != $this->target;
}
return $test == $this->target;
}
}