改名
This commit is contained in:
@@ -6,7 +6,9 @@ namespace Annotation;
|
|||||||
|
|
||||||
use DirectoryIterator;
|
use DirectoryIterator;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use ReflectionException;
|
||||||
use Snowflake\Abstracts\Component;
|
use Snowflake\Abstracts\Component;
|
||||||
|
use Snowflake\Exception\NotFindClassException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Annotation
|
* Class Annotation
|
||||||
@@ -166,6 +168,8 @@ class Annotation extends Component
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param object $class
|
* @param object $class
|
||||||
|
* @throws ReflectionException
|
||||||
|
* @throws NotFindClassException
|
||||||
*/
|
*/
|
||||||
public function injectProperty(object $class)
|
public function injectProperty(object $class)
|
||||||
{
|
{
|
||||||
@@ -189,10 +193,10 @@ class Annotation extends Component
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $dir
|
* @param string $dir
|
||||||
* @param string|array $outPath
|
* @return array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function runtime(string $dir)
|
public function runtime(string $dir): array
|
||||||
{
|
{
|
||||||
return $this->_loader->loadByDirectory($dir);
|
return $this->_loader->loadByDirectory($dir);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,20 +165,20 @@ class Loader extends BaseObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @param string|array $outPath
|
* @return array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function loadByDirectory(string $path)
|
public function loadByDirectory(string $path): array
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$path = '/' . trim($path, '/');
|
$path = '/' . trim($path, '/');
|
||||||
|
|
||||||
$paths = [];
|
$paths = [];
|
||||||
foreach (static::$_directory as $key => $_path) {
|
foreach (static::$_directory as $key => $_path) {
|
||||||
$key = '/' . trim($key, '/');
|
$key = '/' . trim($key, '/');
|
||||||
if (!str_starts_with($key, $path)) {
|
if (!str_starts_with($key, $path)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
unset(static::$_directory[$key]);
|
||||||
foreach ($_path as $item) {
|
foreach ($_path as $item) {
|
||||||
$paths[] = $item;
|
$paths[] = $item;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ use Snowflake\Event;
|
|||||||
use Snowflake\Exception\ConfigException;
|
use Snowflake\Exception\ConfigException;
|
||||||
use Snowflake\Runtime;
|
use Snowflake\Runtime;
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
use Swoole\Coroutine;
|
|
||||||
use Swoole\Server;
|
use Swoole\Server;
|
||||||
use Swoole\Timer;
|
use Swoole\Timer;
|
||||||
|
|
||||||
@@ -38,6 +37,7 @@ class ServerWorker extends \Server\Abstracts\Server
|
|||||||
$this->runEvent(Constant::WORKER_START, null, [$server, $workerId]);
|
$this->runEvent(Constant::WORKER_START, null, [$server, $workerId]);
|
||||||
|
|
||||||
$this->workerInitExecutor($server, $annotation, $workerId);
|
$this->workerInitExecutor($server, $annotation, $workerId);
|
||||||
|
$annotation->runtime(APP_PATH . 'app');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user