eee
This commit is contained in:
+10
-10
@@ -87,7 +87,7 @@ class Container implements ContainerInterface
|
|||||||
/**
|
/**
|
||||||
* @param string $id
|
* @param string $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function get(string $id): object
|
public function get(string $id): object
|
||||||
{
|
{
|
||||||
@@ -103,7 +103,7 @@ class Container implements ContainerInterface
|
|||||||
/**
|
/**
|
||||||
* @param string $id
|
* @param string $id
|
||||||
* @return object
|
* @return object
|
||||||
* @throws ReflectionException
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function parse(string $id): object
|
public function parse(string $id): object
|
||||||
{
|
{
|
||||||
@@ -140,7 +140,7 @@ class Container implements ContainerInterface
|
|||||||
/**
|
/**
|
||||||
* @param string $className
|
* @param string $className
|
||||||
* @return ReflectionClass
|
* @return ReflectionClass
|
||||||
* @throws ReflectionException
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function getReflectionClass(string $className): ReflectionClass
|
public function getReflectionClass(string $className): ReflectionClass
|
||||||
{
|
{
|
||||||
@@ -156,7 +156,7 @@ class Container implements ContainerInterface
|
|||||||
* @param array $construct
|
* @param array $construct
|
||||||
* @param array $config
|
* @param array $config
|
||||||
* @return object|null
|
* @return object|null
|
||||||
* @throws ReflectionException
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function make(string $className, array $construct = [], array $config = []): ?object
|
public function make(string $className, array $construct = [], array $config = []): ?object
|
||||||
{
|
{
|
||||||
@@ -253,7 +253,7 @@ class Container implements ContainerInterface
|
|||||||
* @param string $className
|
* @param string $className
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @return ReflectionMethod
|
* @return ReflectionMethod
|
||||||
* @throws ReflectionException
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function getMethod(string $className, string $method): ReflectionMethod
|
public function getMethod(string $className, string $method): ReflectionMethod
|
||||||
{
|
{
|
||||||
@@ -266,7 +266,7 @@ class Container implements ContainerInterface
|
|||||||
/**
|
/**
|
||||||
* @param string $className
|
* @param string $className
|
||||||
* @return ReflectionMethod[]
|
* @return ReflectionMethod[]
|
||||||
* @throws ReflectionException
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function getMethods(string $className): array
|
public function getMethods(string $className): array
|
||||||
{
|
{
|
||||||
@@ -279,7 +279,7 @@ class Container implements ContainerInterface
|
|||||||
/**
|
/**
|
||||||
* @param ReflectionMethod $parameters
|
* @param ReflectionMethod $parameters
|
||||||
* @return array
|
* @return array
|
||||||
* @throws ReflectionException
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function getMethodParams(ReflectionMethod $parameters): array
|
public function getMethodParams(ReflectionMethod $parameters): array
|
||||||
{
|
{
|
||||||
@@ -297,7 +297,7 @@ class Container implements ContainerInterface
|
|||||||
/**
|
/**
|
||||||
* @param Closure $parameters
|
* @param Closure $parameters
|
||||||
* @return array
|
* @return array
|
||||||
* @throws ReflectionException
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function getFunctionParams(Closure $parameters): array
|
public function getFunctionParams(Closure $parameters): array
|
||||||
{
|
{
|
||||||
@@ -308,7 +308,7 @@ class Container implements ContainerInterface
|
|||||||
/**
|
/**
|
||||||
* @param ReflectionMethod|ReflectionFunction $parameters
|
* @param ReflectionMethod|ReflectionFunction $parameters
|
||||||
* @return array
|
* @return array
|
||||||
* @throws ReflectionException|Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function resolveMethodParams(ReflectionMethod|ReflectionFunction $parameters): array
|
public function resolveMethodParams(ReflectionMethod|ReflectionFunction $parameters): array
|
||||||
{
|
{
|
||||||
@@ -335,7 +335,7 @@ class Container implements ContainerInterface
|
|||||||
/**
|
/**
|
||||||
* @param $parameter
|
* @param $parameter
|
||||||
* @return bool|int|mixed|object|string|null
|
* @return bool|int|mixed|object|string|null
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
protected function contractParams($parameter): mixed
|
protected function contractParams($parameter): mixed
|
||||||
{
|
{
|
||||||
|
|||||||
+18
-19
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||||||
namespace Kiri\Di\Inject;
|
namespace Kiri\Di\Inject;
|
||||||
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use Kiri\Di\Interface\InjectPropertyInterface;
|
use Kiri\Di\Interface\InjectPropertyInterface;
|
||||||
use Kiri\Di\Container as DContainer;
|
use Kiri\Di\Container as DContainer;
|
||||||
|
|
||||||
@@ -13,26 +12,26 @@ class Container implements InjectPropertyInterface
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $service
|
* @param string $service
|
||||||
* @param mixed|null $default
|
* @param mixed|null $default
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function __construct(readonly public string $service, public mixed $default = null)
|
public function __construct(readonly public string $service, public mixed $default = null)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param object $class
|
* @param object $class
|
||||||
* @param string $property
|
* @param string $property
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function dispatch(object $class, string $property): void
|
public function dispatch(object $class, string $property): void
|
||||||
{
|
{
|
||||||
$class->{$property} = DContainer::instance()->get($this->service);
|
$class->{$property} = DContainer::instance()->get($this->service);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-4
@@ -9,7 +9,6 @@ use Kiri\Di\Inject\Container;
|
|||||||
use Kiri\Abstracts\Component;
|
use Kiri\Abstracts\Component;
|
||||||
use Kiri\Di\Inject\Skip;
|
use Kiri\Di\Inject\Skip;
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
use ReflectionException;
|
|
||||||
use ReflectionMethod;
|
use ReflectionMethod;
|
||||||
|
|
||||||
class Scanner extends Component
|
class Scanner extends Component
|
||||||
@@ -26,7 +25,7 @@ class Scanner extends Component
|
|||||||
/**
|
/**
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ReflectionException
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function load_directory(string $path): void
|
public function load_directory(string $path): void
|
||||||
{
|
{
|
||||||
@@ -67,7 +66,7 @@ class Scanner extends Component
|
|||||||
/**
|
/**
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ReflectionException
|
* @throws
|
||||||
*/
|
*/
|
||||||
private function load_file(string $path): void
|
private function load_file(string $path): void
|
||||||
{
|
{
|
||||||
@@ -85,7 +84,7 @@ class Scanner extends Component
|
|||||||
/**
|
/**
|
||||||
* @param $file
|
* @param $file
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ReflectionException
|
* @throws
|
||||||
*/
|
*/
|
||||||
protected function parseFile($file): void
|
protected function parseFile($file): void
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user