updated plugin W3 Total Cache
version 2.3.3
This commit is contained in:
35
wp-content/plugins/w3-total-cache/vendor/guzzlehttp/psr7/tests/Helpers.php
vendored
Normal file
35
wp-content/plugins/w3-total-cache/vendor/guzzlehttp/psr7/tests/Helpers.php
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace GuzzleHttp\Tests\Psr7;
|
||||
|
||||
class Helpers
|
||||
{
|
||||
/**
|
||||
* @param object $object
|
||||
* @param string $attributeName
|
||||
*/
|
||||
public static function readObjectAttribute($object, $attributeName)
|
||||
{
|
||||
$reflector = new \ReflectionObject($object);
|
||||
|
||||
do {
|
||||
try {
|
||||
$attribute = $reflector->getProperty($attributeName);
|
||||
|
||||
if (!$attribute || $attribute->isPublic()) {
|
||||
return $object->$attributeName;
|
||||
}
|
||||
|
||||
$attribute->setAccessible(true);
|
||||
|
||||
return $attribute->getValue($object);
|
||||
} catch (\ReflectionException $e) {
|
||||
// do nothing
|
||||
}
|
||||
} while ($reflector = $reflector->getParentClass());
|
||||
|
||||
throw new \Exception(
|
||||
sprintf('Attribute "%s" not found in object.', $attributeName)
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user