first commit - working
This commit is contained in:
8
vendor/sebastian/object-reflector/.psalm/baseline.xml
vendored
Normal file
8
vendor/sebastian/object-reflector/.psalm/baseline.xml
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<files psalm-version="4.0.1@b1e2e30026936ef8d5bf6a354d1c3959b6231f44">
|
||||
<file src="src/ObjectReflector.php">
|
||||
<DocblockTypeContradiction occurrences="1">
|
||||
<code>is_object($object)</code>
|
||||
</DocblockTypeContradiction>
|
||||
</file>
|
||||
</files>
|
16
vendor/sebastian/object-reflector/.psalm/config.xml
vendored
Normal file
16
vendor/sebastian/object-reflector/.psalm/config.xml
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<psalm
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="https://getpsalm.org/schema/config"
|
||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||
resolveFromConfigFile="false"
|
||||
totallyTyped="false"
|
||||
errorBaseline=".psalm/baseline.xml"
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="src" />
|
||||
<ignoreFiles>
|
||||
<directory name="vendor" />
|
||||
</ignoreFiles>
|
||||
</projectFiles>
|
||||
</psalm>
|
55
vendor/sebastian/object-reflector/ChangeLog.md
vendored
Normal file
55
vendor/sebastian/object-reflector/ChangeLog.md
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to `sebastianbergmann/object-reflector` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [2.0.4] - 2020-10-26
|
||||
|
||||
### Fixed
|
||||
|
||||
* `SebastianBergmann\ObjectReflector\Exception` now correctly extends `\Throwable`
|
||||
|
||||
## [2.0.3] - 2020-09-28
|
||||
|
||||
### Changed
|
||||
|
||||
* Changed PHP version constraint in `composer.json` from `^7.3 || ^8.0` to `>=7.3`
|
||||
|
||||
## [2.0.2] - 2020-06-26
|
||||
|
||||
### Added
|
||||
|
||||
* This component is now supported on PHP 8
|
||||
|
||||
## [2.0.1] - 2020-06-15
|
||||
|
||||
### Changed
|
||||
|
||||
* Tests etc. are now ignored for archive exports
|
||||
|
||||
## [2.0.0] - 2020-02-07
|
||||
|
||||
### Removed
|
||||
|
||||
* This component is no longer supported on PHP 7.0, PHP 7.1, and PHP 7.2
|
||||
|
||||
## [1.1.1] - 2017-03-29
|
||||
|
||||
* Fixed [#1](https://github.com/sebastianbergmann/object-reflector/issues/1): Attributes with non-string names are not handled correctly
|
||||
|
||||
## [1.1.0] - 2017-03-16
|
||||
|
||||
### Changed
|
||||
|
||||
* Changed implementation of `ObjectReflector::getattributes()` to use `(array)` cast instead of `ReflectionObject`
|
||||
|
||||
## 1.0.0 - 2017-03-12
|
||||
|
||||
* Initial release
|
||||
|
||||
[2.0.4]: https://github.com/sebastianbergmann/object-reflector/compare/2.0.3...2.0.4
|
||||
[2.0.3]: https://github.com/sebastianbergmann/object-reflector/compare/2.0.2...2.0.3
|
||||
[2.0.2]: https://github.com/sebastianbergmann/object-reflector/compare/2.0.1...2.0.2
|
||||
[2.0.1]: https://github.com/sebastianbergmann/object-reflector/compare/2.0.0...2.0.1
|
||||
[2.0.0]: https://github.com/sebastianbergmann/object-reflector/compare/1.1.1...2.0.0
|
||||
[1.1.1]: https://github.com/sebastianbergmann/object-reflector/compare/1.1.0...1.1.1
|
||||
[1.1.0]: https://github.com/sebastianbergmann/object-reflector/compare/1.0.0...1.1.0
|
33
vendor/sebastian/object-reflector/LICENSE
vendored
Normal file
33
vendor/sebastian/object-reflector/LICENSE
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
Object Reflector
|
||||
|
||||
Copyright (c) 2017-2020, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* 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.
|
||||
|
||||
* Neither the name of Sebastian Bergmann nor the names of his
|
||||
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 OWNER 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.
|
20
vendor/sebastian/object-reflector/README.md
vendored
Normal file
20
vendor/sebastian/object-reflector/README.md
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
# sebastian/object-reflector
|
||||
|
||||
[](https://github.com/sebastianbergmann/object-reflector/actions)
|
||||
[](https://shepherd.dev/github/sebastianbergmann/object-reflector)
|
||||
|
||||
Allows reflection of object attributes, including inherited and non-public ones.
|
||||
|
||||
## Installation
|
||||
|
||||
You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):
|
||||
|
||||
```
|
||||
composer require sebastian/object-reflector
|
||||
```
|
||||
|
||||
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-reflector
|
||||
```
|
41
vendor/sebastian/object-reflector/composer.json
vendored
Normal file
41
vendor/sebastian/object-reflector/composer.json
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "sebastian/object-reflector",
|
||||
"description": "Allows reflection of object attributes, including inherited and non-public ones",
|
||||
"homepage": "https://github.com/sebastianbergmann/object-reflector/",
|
||||
"license": "BSD-3-Clause",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sebastian Bergmann",
|
||||
"email": "sebastian@phpunit.de"
|
||||
}
|
||||
],
|
||||
"prefer-stable": true,
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.3.0"
|
||||
},
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.3"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"classmap": [
|
||||
"tests/_fixture/"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0-dev"
|
||||
}
|
||||
}
|
||||
}
|
16
vendor/sebastian/object-reflector/src/Exception.php
vendored
Normal file
16
vendor/sebastian/object-reflector/src/Exception.php
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of sebastian/object-reflector.
|
||||
*
|
||||
* (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\ObjectReflector;
|
||||
|
||||
use Throwable;
|
||||
|
||||
interface Exception extends Throwable
|
||||
{
|
||||
}
|
14
vendor/sebastian/object-reflector/src/InvalidArgumentException.php
vendored
Normal file
14
vendor/sebastian/object-reflector/src/InvalidArgumentException.php
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of sebastian/object-reflector.
|
||||
*
|
||||
* (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\ObjectReflector;
|
||||
|
||||
class InvalidArgumentException extends \InvalidArgumentException implements Exception
|
||||
{
|
||||
}
|
51
vendor/sebastian/object-reflector/src/ObjectReflector.php
vendored
Normal file
51
vendor/sebastian/object-reflector/src/ObjectReflector.php
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of sebastian/object-reflector.
|
||||
*
|
||||
* (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\ObjectReflector;
|
||||
|
||||
use function count;
|
||||
use function explode;
|
||||
use function get_class;
|
||||
use function is_object;
|
||||
|
||||
class ObjectReflector
|
||||
{
|
||||
/**
|
||||
* @param object $object
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function getAttributes($object): array
|
||||
{
|
||||
if (!is_object($object)) {
|
||||
throw new InvalidArgumentException;
|
||||
}
|
||||
|
||||
$attributes = [];
|
||||
$className = get_class($object);
|
||||
|
||||
foreach ((array) $object as $name => $value) {
|
||||
$name = explode("\0", (string) $name);
|
||||
|
||||
if (count($name) === 1) {
|
||||
$name = $name[0];
|
||||
} else {
|
||||
if ($name[1] !== $className) {
|
||||
$name = $name[1] . '::' . $name[2];
|
||||
} else {
|
||||
$name = $name[2];
|
||||
}
|
||||
}
|
||||
|
||||
$attributes[$name] = $value;
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user