| Server IP : 162.214.74.102 / Your IP : 216.73.216.192 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /opt/cpanel/ea-wappspector/vendor/php-di/php-di/src/Definition/Resolver/ |
Upload File : |
<?php
declare(strict_types=1);
namespace DI\Definition\Resolver;
use DI\Definition\Definition;
use DI\Definition\InstanceDefinition;
use DI\DependencyException;
use Psr\Container\NotFoundExceptionInterface;
/**
* Injects dependencies on an existing instance.
*
* @template-implements DefinitionResolver<InstanceDefinition>
*
* @since 5.0
* @author Matthieu Napoli <matthieu@mnapoli.fr>
*/
class InstanceInjector extends ObjectCreator implements DefinitionResolver
{
/**
* Injects dependencies on an existing instance.
*
* @param InstanceDefinition $definition
* @psalm-suppress ImplementedParamTypeMismatch
*/
public function resolve(Definition $definition, array $parameters = []) : ?object
{
/** @psalm-suppress InvalidCatch */
try {
$this->injectMethodsAndProperties($definition->getInstance(), $definition->getObjectDefinition());
} catch (NotFoundExceptionInterface $e) {
$message = sprintf(
'Error while injecting dependencies into %s: %s',
get_class($definition->getInstance()),
$e->getMessage()
);
throw new DependencyException($message, 0, $e);
}
return $definition;
}
public function isResolvable(Definition $definition, array $parameters = []) : bool
{
return true;
}
}