first commit
This commit is contained in:
95
vendor/sebastian/object-enumerator/ChangeLog.md
vendored
Normal file
95
vendor/sebastian/object-enumerator/ChangeLog.md
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to `sebastianbergmann/object-enumerator` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [5.0.0] - 2023-02-03
|
||||
|
||||
### Removed
|
||||
|
||||
* This component is no longer supported on PHP 7.3, PHP 7.4 and PHP 8.0
|
||||
|
||||
## [4.0.4] - 2020-10-26
|
||||
|
||||
### Fixed
|
||||
|
||||
* `SebastianBergmann\ObjectEnumerator\Exception` now correctly extends `\Throwable`
|
||||
|
||||
## [4.0.3] - 2020-09-28
|
||||
|
||||
### Changed
|
||||
|
||||
* Changed PHP version constraint in `composer.json` from `^7.3 || ^8.0` to `>=7.3`
|
||||
|
||||
## [4.0.2] - 2020-06-26
|
||||
|
||||
### Added
|
||||
|
||||
* This component is now supported on PHP 8
|
||||
|
||||
## [4.0.1] - 2020-06-15
|
||||
|
||||
### Changed
|
||||
|
||||
* Tests etc. are now ignored for archive exports
|
||||
|
||||
## [4.0.0] - 2020-02-07
|
||||
|
||||
### Removed
|
||||
|
||||
* This component is no longer supported on PHP 7.0, PHP 7.1, and PHP 7.2
|
||||
|
||||
## [3.0.3] - 2017-08-03
|
||||
|
||||
### Changed
|
||||
|
||||
* Bumped required version of `sebastian/object-reflector`
|
||||
|
||||
## [3.0.2] - 2017-03-12
|
||||
|
||||
### Changed
|
||||
|
||||
* `sebastian/object-reflector` is now a dependency
|
||||
|
||||
## [3.0.1] - 2017-03-12
|
||||
|
||||
### Fixed
|
||||
|
||||
* Objects aggregated in inherited attributes are not enumerated
|
||||
|
||||
## [3.0.0] - 2017-03-03
|
||||
|
||||
### Removed
|
||||
|
||||
* This component is no longer supported on PHP 5.6
|
||||
|
||||
## [2.0.1] - 2017-02-18
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#2](https://github.com/sebastianbergmann/phpunit/pull/2): Exceptions in `ReflectionProperty::getValue()` are not handled
|
||||
|
||||
## [2.0.0] - 2016-11-19
|
||||
|
||||
### Changed
|
||||
|
||||
* This component is now compatible with `sebastian/recursion-context: ~1.0.4`
|
||||
|
||||
## 1.0.0 - 2016-02-04
|
||||
|
||||
### Added
|
||||
|
||||
* Initial release
|
||||
|
||||
[5.0.0]: https://github.com/sebastianbergmann/object-enumerator/compare/4.0.4...5.0.0
|
||||
[4.0.4]: https://github.com/sebastianbergmann/object-enumerator/compare/4.0.3...4.0.4
|
||||
[4.0.3]: https://github.com/sebastianbergmann/object-enumerator/compare/4.0.2...4.0.3
|
||||
[4.0.2]: https://github.com/sebastianbergmann/object-enumerator/compare/4.0.1...4.0.2
|
||||
[4.0.1]: https://github.com/sebastianbergmann/object-enumerator/compare/4.0.0...4.0.1
|
||||
[4.0.0]: https://github.com/sebastianbergmann/object-enumerator/compare/3.0.3...4.0.0
|
||||
[3.0.3]: https://github.com/sebastianbergmann/object-enumerator/compare/3.0.2...3.0.3
|
||||
[3.0.2]: https://github.com/sebastianbergmann/object-enumerator/compare/3.0.1...3.0.2
|
||||
[3.0.1]: https://github.com/sebastianbergmann/object-enumerator/compare/3.0.0...3.0.1
|
||||
[3.0.0]: https://github.com/sebastianbergmann/object-enumerator/compare/2.0...3.0.0
|
||||
[2.0.1]: https://github.com/sebastianbergmann/object-enumerator/compare/2.0.0...2.0.1
|
||||
[2.0.0]: https://github.com/sebastianbergmann/object-enumerator/compare/1.0...2.0.0
|
||||
|
29
vendor/sebastian/object-enumerator/LICENSE
vendored
Normal file
29
vendor/sebastian/object-enumerator/LICENSE
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2016-2023, Sebastian Bergmann
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
22
vendor/sebastian/object-enumerator/README.md
vendored
Normal file
22
vendor/sebastian/object-enumerator/README.md
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
[](https://packagist.org/packages/sebastian/object-enumerator)
|
||||
[](https://github.com/sebastianbergmann/object-enumerator/actions)
|
||||
[](https://shepherd.dev/github/sebastianbergmann/object-enumerator)
|
||||
[](https://codecov.io/gh/sebastianbergmann/object-enumerator)
|
||||
|
||||
# sebastian/object-enumerator
|
||||
|
||||
Traverses array structures and object graphs to enumerate all referenced objects.
|
||||
|
||||
## Installation
|
||||
|
||||
You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):
|
||||
|
||||
```
|
||||
composer require sebastian/object-enumerator
|
||||
```
|
||||
|
||||
If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:
|
||||
|
||||
```
|
||||
composer require --dev sebastian/object-enumerator
|
||||
```
|
9
vendor/sebastian/object-enumerator/SECURITY.md
vendored
Normal file
9
vendor/sebastian/object-enumerator/SECURITY.md
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
# Security Policy
|
||||
|
||||
This library is intended to be used in development environments only. For instance, it is used by the testing framework PHPUnit. There is no reason why this library should be installed on a webserver.
|
||||
|
||||
**If you upload this library to a webserver then your deployment process is broken. On a more general note, if your `vendor` directory is publicly accessible on your webserver then your deployment process is also broken.**
|
||||
|
||||
## Security Contact Information
|
||||
|
||||
After the above, if you still would like to report a security vulnerability, please email `sebastian@phpunit.de`.
|
43
vendor/sebastian/object-enumerator/composer.json
vendored
Normal file
43
vendor/sebastian/object-enumerator/composer.json
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "sebastian/object-enumerator",
|
||||
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
|
||||
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
|
||||
"license": "BSD-3-Clause",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de"
|
||||
}
|
||||
],
|
||||
"prefer-stable": true,
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "8.1.0"
|
||||
},
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"sebastian/object-reflector": "^3.0",
|
||||
"sebastian/recursion-context": "^5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^10.0"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"classmap": [
|
||||
"tests/_fixture/"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "5.0-dev"
|
||||
}
|
||||
}
|
||||
}
|
24
vendor/sebastian/object-enumerator/phpunit.xml
vendored
Normal file
24
vendor/sebastian/object-enumerator/phpunit.xml
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
cacheDirectory=".phpunit.cache"
|
||||
executionOrder="depends,defects"
|
||||
requireCoverageMetadata="true"
|
||||
beStrictAboutCoverageMetadata="true"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
failOnRisky="true"
|
||||
failOnWarning="true"
|
||||
colors="true">
|
||||
<testsuites>
|
||||
<testsuite name="default">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<coverage>
|
||||
<include>
|
||||
<directory suffix=".php">src</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
</phpunit>
|
68
vendor/sebastian/object-enumerator/src/Enumerator.php
vendored
Normal file
68
vendor/sebastian/object-enumerator/src/Enumerator.php
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of sebastian/object-enumerator.
|
||||
*
|
||||
* (c) Sebastian Bergmann <sebastian@phpunit.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace SebastianBergmann\ObjectEnumerator;
|
||||
|
||||
use function array_merge;
|
||||
use function is_array;
|
||||
use function is_object;
|
||||
use SebastianBergmann\ObjectReflector\ObjectReflector;
|
||||
use SebastianBergmann\RecursionContext\Context;
|
||||
|
||||
final class Enumerator
|
||||
{
|
||||
/**
|
||||
* @psalm-return list<object>
|
||||
*/
|
||||
public function enumerate(array|object $variable, Context $processed = new Context): array
|
||||
{
|
||||
$objects = [];
|
||||
|
||||
if ($processed->contains($variable)) {
|
||||
return $objects;
|
||||
}
|
||||
|
||||
$array = $variable;
|
||||
|
||||
/* @noinspection UnusedFunctionResultInspection */
|
||||
$processed->add($variable);
|
||||
|
||||
if (is_array($variable)) {
|
||||
foreach ($array as $element) {
|
||||
if (!is_array($element) && !is_object($element)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/** @noinspection SlowArrayOperationsInLoopInspection */
|
||||
$objects = array_merge(
|
||||
$objects,
|
||||
$this->enumerate($element, $processed)
|
||||
);
|
||||
}
|
||||
|
||||
return $objects;
|
||||
}
|
||||
|
||||
$objects[] = $variable;
|
||||
|
||||
foreach ((new ObjectReflector)->getProperties($variable) as $value) {
|
||||
if (!is_array($value) && !is_object($value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/** @noinspection SlowArrayOperationsInLoopInspection */
|
||||
$objects = array_merge(
|
||||
$objects,
|
||||
$this->enumerate($value, $processed)
|
||||
);
|
||||
}
|
||||
|
||||
return $objects;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user