Files
kiri-container/Inject/ContainerParams.php
T

35 lines
534 B
PHP
Raw Normal View History

2023-04-15 23:32:00 +08:00
<?php
2023-04-16 01:45:33 +08:00
declare(strict_types=1);
2023-04-15 23:32:00 +08:00
namespace Kiri\Di\Inject;
2023-10-24 17:22:28 +08:00
use Exception;
2023-04-15 23:32:00 +08:00
use Kiri\Di\Container;
use Kiri\Di\Interface\InjectParameterInterface;
#[\Attribute(\Attribute::TARGET_PARAMETER)]
class ContainerParams implements InjectParameterInterface
{
/**
* @param mixed $value
*/
public function __construct(readonly public mixed $value)
{
}
/**
* @return mixed|null
2023-10-24 17:22:28 +08:00
* @throws Exception
2023-04-15 23:32:00 +08:00
*/
2023-04-16 12:49:55 +08:00
public function dispatch(string $class, string $method): mixed
2023-04-15 23:32:00 +08:00
{
return Container::instance()->get($this->value);
}
}