Final Class Yiisoft\Yii\Debug\Collector\ContainerInterfaceProxy
| Inheritance | Yiisoft\Yii\Debug\Collector\ContainerInterfaceProxy |
|---|---|
| Implements | Psr\Container\ContainerInterface |
| Uses Traits | Yiisoft\Proxy\ProxyTrait, Yiisoft\Yii\Debug\Collector\ProxyLogTrait, Yiisoft\Yii\Debug\ProxyDecoratedCalls |
Protected Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $decorated | \Psr\Container\ContainerInterface | Yiisoft\Yii\Debug\Collector\ContainerInterfaceProxy |
Public Methods
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| logProxy() | Yiisoft\Yii\Debug\Collector\ProxyLogTrait |
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| LOG_ARGUMENTS | 1 | Yiisoft\Yii\Debug\Collector\ContainerInterfaceProxy | |
| LOG_ERROR | 4 | Yiisoft\Yii\Debug\Collector\ContainerInterfaceProxy | |
| LOG_NOTHING | 0 | Yiisoft\Yii\Debug\Collector\ContainerInterfaceProxy | |
| LOG_RESULT | 2 | Yiisoft\Yii\Debug\Collector\ContainerInterfaceProxy |
Property Details
Method Details
Defined in: Yiisoft\Yii\Debug\ProxyDecoratedCalls::__call()
| public mixed __call ( string $name, array $arguments ) | ||
| $name | string | |
| $arguments | array | |
public function __call(string $name, array $arguments)
{
/**
* @psalm-suppress MixedMethodCall
*/
return $this->decorated->$name(...$arguments);
}
| public mixed __construct ( \Psr\Container\ContainerInterface $decorated, Yiisoft\Yii\Debug\Collector\ContainerProxyConfig $config ) | ||
| $decorated | \Psr\Container\ContainerInterface | |
| $config | Yiisoft\Yii\Debug\Collector\ContainerProxyConfig | |
public function __construct(
protected ContainerInterface $decorated,
ContainerProxyConfig $config,
) {
$this->config = $config;
$this->proxyManager = new ProxyManager($this->config->getProxyCachePath());
}
Defined in: Yiisoft\Yii\Debug\ProxyDecoratedCalls::__get()
| public mixed __get ( string $name ) | ||
| $name | string | |
public function __get(string $name)
{
return $this->decorated->$name;
}
Defined in: Yiisoft\Yii\Debug\ProxyDecoratedCalls::__set()
| public void __set ( string $name, mixed $value ) | ||
| $name | string | |
| $value | mixed | |
public function __set(string $name, mixed $value): void
{
$this->decorated->$name = $value;
}
| public mixed get ( mixed $id ) | ||
| $id | mixed | |
public function get($id): mixed
{
$this->resetCurrentError();
$timeStart = microtime(true);
$instance = null;
try {
$instance = $this->getInstance($id);
} catch (ContainerExceptionInterface $e) {
$this->repeatError($e);
} finally {
$this->logProxy(ContainerInterface::class, $this->decorated, 'get', [$id], $instance, $timeStart);
}
if (
is_object($instance)
&& (
($proxy = $this->getServiceProxyCache($id)) ||
($proxy = $this->getServiceProxy($id, $instance))
)
) {
$this->setServiceProxyCache($id, $proxy);
return $proxy;
}
return $instance;
}
| public boolean has ( mixed $id ) | ||
| $id | mixed | |
public function has($id): bool
{
$this->resetCurrentError();
$timeStart = microtime(true);
$result = null;
try {
$result = $this->decorated->has($id);
} catch (ContainerExceptionInterface $e) {
$this->repeatError($e);
} finally {
$this->logProxy(ContainerInterface::class, $this->decorated, 'has', [$id], $result, $timeStart);
}
return (bool)$result;
}
| public boolean isActive ( ) |
public function isActive(): bool
{
return $this->config->getIsActive() && $this->config->getDecoratedServices() !== [];
}
| protected void logProxy ( string $service, object $instance, string $method, array $arguments, mixed $result, float $timeStart ) | ||
| $service | string | |
| $instance | object | |
| $method | string | |
| $arguments | array | |
| $result | mixed | |
| $timeStart | float | |
protected function logProxy(
string $service,
object $instance,
string $method,
array $arguments,
mixed $result,
float $timeStart
): void {
$error = $this->getCurrentError();
$this->processLogData($arguments, $result, $error);
if ($this->config->getCollector() !== null) {
$this->logToCollector($service, $instance, $method, $arguments, $result, $error, $timeStart);
}
if ($this->config->getDispatcher() !== null) {
$this->logToEvent($service, $instance, $method, $arguments, $result, $error, $timeStart);
}
}
| public self withDecoratedServices ( array $decoratedServices ) | ||
| $decoratedServices | array | |
public function withDecoratedServices(array $decoratedServices): self
{
$new = clone $this;
$new->config = $this->config->withDecoratedServices($decoratedServices);
return $new;
}
Signup or Login in order to comment.