This commit is contained in:
as2252258@163.com
2021-08-11 01:04:57 +08:00
parent 63d8eaa4a5
commit 682246df28
219 changed files with 790 additions and 791 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ namespace Annotation;
use DirectoryIterator;
use Exception;
use ReflectionException;
use Snowflake\Abstracts\Component;
use Kiri\Abstracts\Component;
/**
* Class Annotation
+3 -3
View File
@@ -5,9 +5,9 @@ namespace Annotation;
use Exception;
use Snowflake\Aop;
use Snowflake\IAspect;
use Snowflake\Snowflake;
use Kiri\Aop;
use Kiri\IAspect;
use Kiri\Kiri;
defined('ASPECT_ERROR') or define('ASPECT_ERROR', 'Aspect annotation must implement ');
+2 -2
View File
@@ -6,7 +6,7 @@ namespace Annotation;
use Exception;
use HttpServer\IInterface\Task;
use Snowflake\Snowflake;
use Kiri\Kiri;
/**
@@ -36,7 +36,7 @@ use Snowflake\Snowflake;
*/
public function execute(mixed $class, mixed $method = null): bool
{
$async = Snowflake::app()->getAsync();
$async = Kiri::app()->getAsync();
$async->addAsync($this->name, $class);
return true;
}
+3 -3
View File
@@ -5,9 +5,9 @@ namespace Annotation;
use Exception;
use Snowflake\Exception\ComponentException;
use Snowflake\Snowflake;
use Snowflake\Event as SEvent;
use Kiri\Exception\ComponentException;
use Kiri\Kiri;
use Kiri\Event as SEvent;
/**
+6 -6
View File
@@ -8,8 +8,8 @@ use Exception;
use HttpServer\Http\Context;
use ReflectionException;
use ReflectionProperty;
use Snowflake\Core\Str;
use Snowflake\Snowflake;
use Kiri\Core\Str;
use Kiri\Kiri;
/**
* Class Inject
@@ -81,7 +81,7 @@ use Snowflake\Snowflake;
return $method;
}
if (is_object($class)) $class = $class::class;
$method = Snowflake::getDi()->getClassReflectionProperty($class, $method);
$method = Kiri::getDi()->getClassReflectionProperty($class, $method);
if (!$method || $method->isStatic()) {
return false;
}
@@ -99,9 +99,9 @@ use Snowflake\Snowflake;
return Context::getContext($this->value);
}
if (class_exists($this->value)) {
return Snowflake::getDi()->get($this->value, $this->args);
} else if (Snowflake::app()->has($this->value)) {
return Snowflake::app()->get($this->value);
return Kiri::getDi()->get($this->value, $this->args);
} else if (Kiri::app()->has($this->value)) {
return Kiri::app()->get($this->value);
} else {
return $this->value;
}
+2 -2
View File
@@ -7,7 +7,7 @@ namespace Annotation;
use Exception;
use Kafka\ConsumerInterface;
use Kafka\KafkaProvider;
use Snowflake\Snowflake;
use Kiri\Kiri;
/**
* Class Kafka
@@ -39,7 +39,7 @@ use Snowflake\Snowflake;
}
/** @var KafkaProvider $container */
$container = Snowflake::getDi()->get(KafkaProvider::class);
$container = Kiri::getDi()->get(KafkaProvider::class);
$container->addConsumer($this->topic, $class);
return true;
+5 -5
View File
@@ -8,8 +8,8 @@ use DirectoryIterator;
use Exception;
use ReflectionClass;
use ReflectionException;
use Snowflake\Abstracts\BaseObject;
use Snowflake\Snowflake;
use Kiri\Abstracts\BaseObject;
use Kiri\Kiri;
use Throwable;
@@ -51,7 +51,7 @@ class Loader extends BaseObject
*/
public function getProperty(string $class, string $property = ''): \ReflectionProperty|array|null
{
return Snowflake::getDi()->getClassReflectionProperty($class, $property);
return Kiri::getDi()->getClassReflectionProperty($class, $property);
}
@@ -64,7 +64,7 @@ class Loader extends BaseObject
*/
public function injectProperty(string $class, object $handler): static
{
$di = Snowflake::getDi();
$di = Kiri::getDi();
$reflect = $di->getReflect($class);
@@ -151,7 +151,7 @@ class Loader extends BaseObject
*/
private function getReflect(DirectoryIterator $path, string $namespace): ?ReflectionClass
{
return Snowflake::getDi()->getReflect($this->explodeFileName($path, $namespace));
return Kiri::getDi()->getReflect($this->explodeFileName($path, $namespace));
}
+4 -4
View File
@@ -5,8 +5,8 @@ namespace Annotation;
use Exception;
use Snowflake\Event;
use Snowflake\Snowflake;
use Kiri\Event;
use Kiri\Kiri;
/**
* Class LocalService
@@ -29,7 +29,7 @@ use Snowflake\Snowflake;
return;
}
Event::on(Event::SERVER_WORKER_EXIT, function () {
Snowflake::app()->remove($this->service);
Kiri::app()->remove($this->service);
});
}
@@ -47,7 +47,7 @@ use Snowflake\Snowflake;
$class = array_merge($class, $this->args);
}
Snowflake::set($this->service, $class);
Kiri::set($this->service, $class);
return true; // TODO: Change the autogenerated stub
}
+2 -2
View File
@@ -6,7 +6,7 @@ namespace Annotation\Model;
use Attribute;
use Exception;
use Snowflake\Snowflake;
use Kiri\Kiri;
/**
@@ -34,7 +34,7 @@ use Snowflake\Snowflake;
*/
public function execute(mixed $class, mixed $method = null): bool
{
$annotation = Snowflake::getAnnotation();
$annotation = Kiri::getAnnotation();
$annotation->addGets($class::class, $this->name, $method);
return true;
}
+2 -2
View File
@@ -8,7 +8,7 @@ use Annotation\Attribute;
use Database\ActiveRecord;
use Exception;
use JetBrains\PhpStorm\Pure;
use Snowflake\Snowflake;
use Kiri\Kiri;
/**
@@ -36,7 +36,7 @@ use Snowflake\Snowflake;
*/
public function execute(mixed $class, mixed $method = null): bool
{
$annotation = Snowflake::getAnnotation();
$annotation = Kiri::getAnnotation();
$annotation->addRelate($class::class, $this->name, $method);
return true;
}
+2 -2
View File
@@ -7,7 +7,7 @@ namespace Annotation\Model;
use Annotation\Attribute;
use Database\ActiveRecord;
use Exception;
use Snowflake\Snowflake;
use Kiri\Kiri;
#[\Attribute(\Attribute::TARGET_METHOD)] class Set extends Attribute
{
@@ -30,7 +30,7 @@ use Snowflake\Snowflake;
*/
public function execute(mixed $class, mixed $method = null): bool
{
$annotation = Snowflake::getAnnotation();
$annotation = Kiri::getAnnotation();
$annotation->addSets($class::class, $this->name, $method);
return true;
}
+3 -3
View File
@@ -8,9 +8,9 @@ use Annotation\Attribute;
use Exception;
use HttpServer\HttpFilter;
use ReflectionException;
use Snowflake\Exception\ComponentException;
use Snowflake\Exception\NotFindClassException;
use Snowflake\Snowflake;
use Kiri\Exception\ComponentException;
use Kiri\Exception\NotFindClassException;
use Kiri\Kiri;
/**
* Class Filter
+3 -3
View File
@@ -7,8 +7,8 @@ namespace Annotation\Route;
use Annotation\Attribute;
use HttpServer\Route\MiddlewareManager;
use ReflectionException;
use Snowflake\Exception\NotFindClassException;
use Snowflake\Snowflake;
use Kiri\Exception\NotFindClassException;
use Kiri\Kiri;
use HttpServer\IInterface\Middleware as IMiddleware;
/**
@@ -51,7 +51,7 @@ use HttpServer\IInterface\Middleware as IMiddleware;
*/
public function execute(mixed $class, mixed $method = null): static
{
$middleware = Snowflake::getDi()->get(MiddlewareManager::class);
$middleware = Kiri::getDi()->get(MiddlewareManager::class);
$middleware->addMiddlewares($class, $method, $this->middleware);
return $this;
}
+2 -2
View File
@@ -7,7 +7,7 @@ namespace Annotation\Route;
use Annotation\Attribute;
use Exception;
use HttpServer\Route\Router;
use Snowflake\Snowflake;
use Kiri\Kiri;
#[\Attribute(\Attribute::TARGET_METHOD)] class Route extends Attribute
{
@@ -36,7 +36,7 @@ use Snowflake\Snowflake;
public function execute(mixed $class, mixed $method = null): Router
{
// TODO: Implement setHandler() method.
$router = Snowflake::app()->getRouter();
$router = Kiri::app()->getRouter();
$router->addRoute($this->uri, [$class, $method], $this->method);
return $router;
}
+2 -2
View File
@@ -10,7 +10,7 @@ use HttpServer\Http\Request;
use HttpServer\Route\Router;
use JetBrains\PhpStorm\Pure;
use Rpc\Actuator;
use Snowflake\Snowflake;
use Kiri\Kiri;
/**
@@ -44,7 +44,7 @@ use Snowflake\Snowflake;
public function execute(mixed $class, mixed $method = null): Router
{
// TODO: Implement setHandler() method.
$router = Snowflake::app()->getRouter();
$router = Kiri::app()->getRouter();
$cmd = $this->cmd;
$callback = function (Actuator $actuator) use ($cmd, $class, $method) {
$actuator->addListener($cmd, $class::class . '@' . $method);
+2 -2
View File
@@ -7,7 +7,7 @@ namespace Annotation\Route;
use Annotation\Attribute;
use Exception;
use HttpServer\Route\Router;
use Snowflake\Snowflake;
use Kiri\Kiri;
/**
* Class Socket
@@ -40,7 +40,7 @@ use Snowflake\Snowflake;
public function execute(mixed $class, mixed $method = null): Router
{
// TODO: Implement setHandler() method.
$router = Snowflake::app()->getRouter();
$router = Kiri::app()->getRouter();
$path = $this->event . '::' . (is_null($this->uri) ? 'event' : $this->uri);
+2 -2
View File
@@ -6,7 +6,7 @@ namespace Annotation\Rpc;
use Annotation\Attribute;
use Exception;
use Snowflake\Snowflake;
use Kiri\Kiri;
/**
@@ -35,7 +35,7 @@ use Snowflake\Snowflake;
*/
public function execute(mixed $class, mixed $method = ''): bool
{
$rpc = Snowflake::app()->getRpc();
$rpc = Kiri::app()->getRpc();
$rpc->addConsumer($this->cmd, [$class, $method]);
return true; // TODO: Change the autogenerated stub
}
+2 -2
View File
@@ -6,7 +6,7 @@ namespace Annotation\Rpc;
use Annotation\Attribute;
use Exception;
use Snowflake\Snowflake;
use Kiri\Kiri;
/**
@@ -45,7 +45,7 @@ use Snowflake\Snowflake;
*/
public function execute(mixed $class, mixed $method = ''): bool
{
$rpc = Snowflake::app()->getRpc();
$rpc = Kiri::app()->getRpc();
$rpc->addProducer($this->cmd, [$class, $method], $this->config);
return true;