改名
This commit is contained in:
@@ -9,7 +9,6 @@ use Exception;
|
||||
use ReflectionClass;
|
||||
use ReflectionException;
|
||||
use Snowflake\Abstracts\BaseObject;
|
||||
use Snowflake\Exception\NotFindClassException;
|
||||
use Snowflake\Snowflake;
|
||||
use Throwable;
|
||||
|
||||
@@ -48,6 +47,7 @@ class Loader extends BaseObject
|
||||
* @param string $class
|
||||
* @param string $property
|
||||
* @return mixed
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function getProperty(string $class, string $property = ''): mixed
|
||||
{
|
||||
@@ -67,7 +67,6 @@ class Loader extends BaseObject
|
||||
* @param string $class
|
||||
* @param object $handler
|
||||
* @return $this
|
||||
* @throws NotFindClassException
|
||||
* @throws ReflectionException
|
||||
* @throws Exception
|
||||
*/
|
||||
@@ -138,7 +137,9 @@ class Loader extends BaseObject
|
||||
return;
|
||||
}
|
||||
$replace = $this->getReflect($path, $namespace);
|
||||
|
||||
if (!$replace->getAttributes(Target::class)) {
|
||||
return;
|
||||
}
|
||||
$this->appendFileToDirectory($path->getRealPath(), $replace->getName());
|
||||
|
||||
static::$_classes[] = $replace->getName();
|
||||
@@ -152,7 +153,6 @@ class Loader extends BaseObject
|
||||
* @param DirectoryIterator $path
|
||||
* @param string $namespace
|
||||
* @return ReflectionClass|null
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
private function getReflect(DirectoryIterator $path, string $namespace): ?ReflectionClass
|
||||
{
|
||||
|
||||
+4
-10
@@ -107,7 +107,9 @@ class Container extends BaseObject
|
||||
private function resolve($class, $constrict, $config): object
|
||||
{
|
||||
$reflect = $this->resolveDependencies($class);
|
||||
|
||||
if (!$reflect->isInstantiable()) {
|
||||
throw new ReflectionException('Class ' . $class . ' cannot be instantiated');
|
||||
}
|
||||
$object = $this->newInstance($reflect, $constrict);
|
||||
|
||||
$this->propertyInject($reflect, $object);
|
||||
@@ -161,7 +163,6 @@ class Container extends BaseObject
|
||||
* @param $className
|
||||
* @param $method
|
||||
* @return array
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function getMethodAttribute($className, $method = null): array
|
||||
{
|
||||
@@ -177,7 +178,6 @@ class Container extends BaseObject
|
||||
* @param string $class
|
||||
* @param string|null $property
|
||||
* @return ReflectionProperty|ReflectionProperty[]|null
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function getClassReflectionProperty(string $class, string $property = null): ReflectionProperty|null|array
|
||||
{
|
||||
@@ -210,14 +210,11 @@ class Container extends BaseObject
|
||||
/**
|
||||
* @param $class
|
||||
* @return ReflectionClass
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
private function resolveDependencies($class): ReflectionClass
|
||||
{
|
||||
$reflect = new ReflectionClass($class);
|
||||
if ($reflect->isAbstract() || !$reflect->isInstantiable()) {
|
||||
throw new ReflectionException('Class ' . $class . ' cannot be instantiated');
|
||||
}
|
||||
|
||||
$this->setPropertyNote($reflect);
|
||||
$this->setTargetNote($reflect);
|
||||
$this->setMethodNote($reflect);
|
||||
@@ -232,7 +229,6 @@ class Container extends BaseObject
|
||||
/**
|
||||
* @param ReflectionClass|string $class
|
||||
* @return ReflectionMethod[]
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function getReflectMethods(ReflectionClass|string $class): array
|
||||
{
|
||||
@@ -247,7 +243,6 @@ class Container extends BaseObject
|
||||
* @param ReflectionClass|string $class
|
||||
* @param string $method
|
||||
* @return ReflectionMethod|null
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function getReflectMethod(ReflectionClass|string $class, string $method): ?ReflectionMethod
|
||||
{
|
||||
@@ -346,7 +341,6 @@ class Container extends BaseObject
|
||||
/**
|
||||
* @param $class
|
||||
* @return ReflectionClass|null
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function getReflect($class): ?ReflectionClass
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user