改名
This commit is contained in:
+70
-66
@@ -16,88 +16,92 @@ class Annotation extends Component
|
||||
{
|
||||
|
||||
|
||||
private Loader $_loader;
|
||||
private Loader $_loader;
|
||||
|
||||
|
||||
public function init(): void
|
||||
{
|
||||
$this->_loader = new Loader();
|
||||
}
|
||||
public function init(): void
|
||||
{
|
||||
$this->_loader = new Loader();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Loader
|
||||
*/
|
||||
public function getLoader(): Loader
|
||||
{
|
||||
return $this->_loader;
|
||||
}
|
||||
/**
|
||||
* @return Loader
|
||||
*/
|
||||
public function getLoader(): Loader
|
||||
{
|
||||
return $this->_loader;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Loader $loader
|
||||
* @return Loader
|
||||
*/
|
||||
public function setLoader(Loader $loader): Loader
|
||||
{
|
||||
return $this->_loader = $loader;
|
||||
}
|
||||
/**
|
||||
* @param Loader $loader
|
||||
* @return Loader
|
||||
*/
|
||||
public function setLoader(Loader $loader): Loader
|
||||
{
|
||||
return $this->_loader = $loader;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $method
|
||||
* @return array 根据类名获取注解
|
||||
* 根据类名获取注解
|
||||
*/
|
||||
public function getMethods(string $className, string $method = ''): mixed
|
||||
{
|
||||
return $this->_loader->getMethod($className, $method);
|
||||
}
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $method
|
||||
* @return array 根据类名获取注解
|
||||
* 根据类名获取注解
|
||||
*/
|
||||
public function getMethods(string $className, string $method = ''): mixed
|
||||
{
|
||||
return $this->_loader->getMethod($className, $method);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param object $class
|
||||
*/
|
||||
public function injectProperty(object $class)
|
||||
{
|
||||
$this->_loader->injectProperty(get_class($class), $class);
|
||||
}
|
||||
/**
|
||||
* @param object $class
|
||||
*/
|
||||
public function injectProperty(object $class)
|
||||
{
|
||||
$this->_loader->injectProperty(get_class($class), $class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
* @param string $namespace
|
||||
* @param string $alias
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function read(string $path, string $namespace, string $alias = 'root'): void
|
||||
{
|
||||
/**
|
||||
* @param string $path
|
||||
* @param string $namespace
|
||||
* @param string $alias
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function read(string $path, string $namespace, string $alias = 'root'): void
|
||||
{
|
||||
|
||||
$this->_loader->_scanDir(new DirectoryIterator($path), $namespace);
|
||||
}
|
||||
$this->_loader->_scanDir(new DirectoryIterator($path), $namespace);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $dir
|
||||
* @param string|null $outPath
|
||||
* @throws Exception
|
||||
*/
|
||||
public function runtime(string $dir, ?string $outPath = null)
|
||||
{
|
||||
$this->_loader->loadByDirectory($dir, $outPath);
|
||||
}
|
||||
/**
|
||||
* @param string $dir
|
||||
* @param string|array|null $outPath
|
||||
* @throws Exception
|
||||
*/
|
||||
public function runtime(string $dir, string|array $outPath = null)
|
||||
{
|
||||
if ($outPath === null) {
|
||||
$outPath = [];
|
||||
} else if (!is_array($outPath)) {
|
||||
$outPath = [$outPath];
|
||||
}
|
||||
$this->_loader->loadByDirectory($dir, $outPath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @return mixed
|
||||
*/
|
||||
public function getFilename(string $filename): mixed
|
||||
{
|
||||
return $this->_loader->getClassByFilepath($filename);
|
||||
}
|
||||
/**
|
||||
* @param string $filename
|
||||
* @return mixed
|
||||
*/
|
||||
public function getFilename(string $filename): mixed
|
||||
{
|
||||
return $this->_loader->getClassByFilepath($filename);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user