File "InstanceInjector.php"
Full Path: /home/amervokv/ecomlive.net/wp-content/plugins/elementor/vendor_prefixed/php-di/php-di/src/Definition/Resolver/InstanceInjector.php
File size: 1.17 KB
MIME-type: text/x-php
Charset: utf-8
<?php
declare (strict_types=1);
namespace ElementorDeps\DI\Definition\Resolver;
use ElementorDeps\DI\Definition\Definition;
use ElementorDeps\DI\Definition\InstanceDefinition;
use ElementorDeps\DI\DependencyException;
use ElementorDeps\Psr\Container\NotFoundExceptionInterface;
/**
* Injects dependencies on an existing instance.
*
* @since 5.0
* @author Matthieu Napoli <matthieu@mnapoli.fr>
*/
class InstanceInjector extends ObjectCreator
{
/**
* Injects dependencies on an existing instance.
*
* @param InstanceDefinition $definition
*/
public function resolve(Definition $definition, array $parameters = [])
{
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;
}
}