Files
kiri-container/Inject/Config.php
T

32 lines
505 B
PHP
Raw Normal View History

2023-04-15 23:32:00 +08:00
<?php
namespace Kiri\Di\Inject;
use Kiri\Di\Interface\InjectPropertyInterface;
#[\Attribute(\Attribute::TARGET_PROPERTY)]
class Config implements InjectPropertyInterface
{
/**
* @param string $key
*/
public function __construct(public string $key)
{
}
/**
* @param object $class
* @param string $property
* @return void
*/
public function dispatch(object $class, string $property): void
{
// TODO: Implement dispatch() method.
$class->{$property} = config($this->key);
}
}