| Server IP : 151.101.66.159 / Your IP : 216.73.216.66 Web Server : Flywheel/5.1.0 System : Linux wordpress 6.12.113+ #1 SMP Thu Oct 22 02:38:20 UTC 2026 x86_64 User : root ( ) PHP Version : 7.4.33.18 Disable Function : disk_free_space,diskfreespace,dl,exec,fpassthru,getmypid,getmyuid,highlight_file,link,opcache_compile_file,opcache_get_configuration,opcache_is_script_cached,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,phpinfo,popen,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,socket_listen,source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wp-content/plugins/pods/vendor/vendor-prefixed/lucatume/di52/src/ |
Upload File : |
<?php
/**
* An exception thrown while trying to build or resolve a binding in the container.
*
* @package lucatume\DI52
*
* @license GPL-3.0
* Modified by Scott Kingsley Clark on 24-February-2026 using Strauss.
* @see https://github.com/BrianHenryIE/strauss
*/
namespace Pods\Prefixed\lucatume\DI52;
use Exception;
use Pods\Prefixed\Psr\Container\ContainerExceptionInterface;
use ReflectionClass;
use Throwable;
/**
* Class ContainerException
*
* @package lucatume\DI52
*/
class ContainerException extends Exception implements ContainerExceptionInterface
{
/**
* Extracts a property from an object.
*
* @param object $object The object to extract the property from.
* @param string $property The property to extract.
*
* @return mixed The property value if found, `null` otherwise.
*/
private static function getPropertyValue($object, $property)
{
$reflectionClass = new ReflectionClass($object);
do {
if ($reflectionClass->hasProperty($property)) {
$traceProperty = $reflectionClass->getProperty($property);
$traceProperty->setAccessible(true);
return $traceProperty->getValue($object);
}
$reflectionClass = $reflectionClass->getParentClass();
} while ($reflectionClass instanceof ReflectionClass);
return null;
}
/**
* Sets a private or protected property on an object.
*
* @param object $object The object to set the property on.
* @param string $property The property to set.
* @param mixed $value The value to set.
*
* @return bool Whether the property was set or not.
*/
private static function setPropertyValue($object, $property, $value)
{
$reflectionClass = new ReflectionClass($object);
do {
if ($reflectionClass->hasProperty($property)) {
$traceProperty = $reflectionClass->getProperty($property);
$traceProperty->setAccessible(true);
$traceProperty->setValue($object, $value);
return true;
}
$reflectionClass = $reflectionClass->getParentClass();
} while ($reflectionClass instanceof ReflectionClass);
return false;
}
/**
* Formats an error message to provide a useful debug message.
*
* @param string|object $id The id of what is actually being built or the object that is being built.
* @param Exception|Throwable $thrown The original exception thrown while trying to make the target.
* @param array<string> $buildLine A set of consecutive items the resolver is currently trying to build.
*
* @return string The formatted make error message.
*/
private static function makeBuildLineErrorMessage($id, $thrown, array $buildLine)
{
$idString = is_string($id) ? $id : gettype($id);
if ($thrown instanceof NestedParseError) {
$last = $thrown->getType() . ' $' . $thrown->getName();
} else {
$last = array_pop($buildLine) ?: $idString;
}
$lastEntry = "Error while making {$last}: " . lcfirst(
rtrim(
str_replace('"', '', $thrown->getMessage()),
'.'
)
) . '.';
$frags = array_merge($buildLine, [$lastEntry]);
return implode("\n\t=> ", $frags);
}
/**
* Builds a container exception from a throwable.
*
* @param string|object $id The id of what is actually being built or the object that is being built.
* @param Exception|Throwable $thrown The throwable to build the exception from.
* @param int $maskThrowables The bitmask of throwable properties to mask.
* @param array<string> $buildLine A set of consecutive items the resolver is currently trying to build.
*
* @return ContainerException The built Container exception.
*/
public static function fromThrowable($id, $thrown, $maskThrowables, array $buildLine)
{
$message = ($maskThrowables & Container::EXCEPTION_MASK_MESSAGE) ?
self::makeBuildLineErrorMessage($id, $thrown, $buildLine)
: $thrown->getMessage();
$exceptionClass = $thrown instanceof self ?
get_class($thrown)
: self::class;
$built = new $exceptionClass($message, $thrown->getCode(), $thrown);
if (($maskThrowables & Container::EXCEPTION_MASK_FILE_LINE)
&& ($thrownFile = self::getPropertyValue($thrown, 'file'))
&& ($thrownLine = self::getPropertyValue($thrown, 'line'))
) {
self::setPropertyValue($built, 'file', $thrownFile);
self::setPropertyValue($built, 'line', $thrownLine);
}
return $built;
}
}