modify
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Abstracts;
|
||||
namespace Kiri\Abstracts;
|
||||
|
||||
|
||||
use Annotation\Annotation as SAnnotation;
|
||||
@@ -28,22 +28,22 @@ use ReflectionException;
|
||||
use Rpc\Producer;
|
||||
use Rpc\Service;
|
||||
use Server\ServerManager;
|
||||
use Snowflake\Aop;
|
||||
use Snowflake\Async;
|
||||
use Snowflake\Cache\Redis;
|
||||
use Snowflake\Di\LocalService;
|
||||
use Snowflake\Error\ErrorHandler;
|
||||
use Snowflake\Error\Logger;
|
||||
use Snowflake\Event;
|
||||
use Snowflake\Exception\InitException;
|
||||
use Snowflake\Exception\NotFindClassException;
|
||||
use Snowflake\Jwt\Jwt;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Aop;
|
||||
use Kiri\Async;
|
||||
use Kiri\Cache\Redis;
|
||||
use Kiri\Di\LocalService;
|
||||
use Kiri\Error\ErrorHandler;
|
||||
use Kiri\Error\Logger;
|
||||
use Kiri\Event;
|
||||
use Kiri\Exception\InitException;
|
||||
use Kiri\Exception\NotFindClassException;
|
||||
use Kiri\Jwt\Jwt;
|
||||
use Kiri\Kiri;
|
||||
use Swoole\Table;
|
||||
|
||||
/**
|
||||
* Class BaseApplication
|
||||
* @package Snowflake\Snowflake\Base
|
||||
* @package Kiri\Kiri\Base
|
||||
*/
|
||||
abstract class BaseApplication extends Component
|
||||
{
|
||||
@@ -66,7 +66,7 @@ abstract class BaseApplication extends Component
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
Snowflake::init($this);
|
||||
Kiri::init($this);
|
||||
|
||||
$config = sweep(APP_PATH . '/config');
|
||||
|
||||
@@ -170,7 +170,7 @@ abstract class BaseApplication extends Component
|
||||
* @param $name
|
||||
* @return mixed
|
||||
* @throws \ReflectionException
|
||||
* @throws \Snowflake\Exception\NotFindClassException
|
||||
* @throws \Kiri\Exception\NotFindClassException
|
||||
*/
|
||||
public function __get($name): mixed
|
||||
{
|
||||
@@ -193,7 +193,7 @@ abstract class BaseApplication extends Component
|
||||
}
|
||||
foreach ($config['events'] as $key => $value) {
|
||||
if (is_string($value)) {
|
||||
$value = Snowflake::createObject($value);
|
||||
$value = Kiri::createObject($value);
|
||||
}
|
||||
$this->addEvent($key, $value);
|
||||
}
|
||||
@@ -225,7 +225,7 @@ abstract class BaseApplication extends Component
|
||||
}
|
||||
|
||||
if (is_string($value[0])) {
|
||||
$value[0] = Snowflake::createObject($value[0]);
|
||||
$value[0] = Kiri::createObject($value[0]);
|
||||
Event::on($key, $value, true);
|
||||
return;
|
||||
}
|
||||
@@ -265,7 +265,7 @@ abstract class BaseApplication extends Component
|
||||
* @param $name
|
||||
* @return mixed
|
||||
* @throws \ReflectionException
|
||||
* @throws \Snowflake\Exception\NotFindClassException
|
||||
* @throws \Kiri\Exception\NotFindClassException
|
||||
*/
|
||||
public function get($name): mixed
|
||||
{
|
||||
@@ -422,7 +422,7 @@ abstract class BaseApplication extends Component
|
||||
/**
|
||||
* @param $array
|
||||
* @throws \ReflectionException
|
||||
* @throws \Snowflake\Exception\NotFindClassException
|
||||
* @throws \Kiri\Exception\NotFindClassException
|
||||
*/
|
||||
private function setComponents($array): void
|
||||
{
|
||||
@@ -434,7 +434,7 @@ abstract class BaseApplication extends Component
|
||||
* @param $id
|
||||
* @param $definition
|
||||
* @throws \ReflectionException
|
||||
* @throws \Snowflake\Exception\NotFindClassException
|
||||
* @throws \Kiri\Exception\NotFindClassException
|
||||
*/
|
||||
public function set($id, $definition): void
|
||||
{
|
||||
@@ -446,7 +446,7 @@ abstract class BaseApplication extends Component
|
||||
* @param $id
|
||||
* @param $definition
|
||||
* @throws \ReflectionException
|
||||
* @throws \Snowflake\Exception\NotFindClassException
|
||||
* @throws \Kiri\Exception\NotFindClassException
|
||||
*/
|
||||
public function has($id): bool
|
||||
{
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Abstracts;
|
||||
namespace Kiri\Abstracts;
|
||||
|
||||
|
||||
use Exception;
|
||||
use HttpServer\Exception\ExitException;
|
||||
use Snowflake\Core\Json;
|
||||
use Kiri\Core\Json;
|
||||
|
||||
/**
|
||||
* Class BaseGoto
|
||||
* @package Snowflake\Abstracts
|
||||
* @package Kiri\Abstracts
|
||||
*/
|
||||
class BaseGoto extends Component
|
||||
{
|
||||
|
||||
@@ -7,17 +7,17 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Abstracts;
|
||||
namespace Kiri\Abstracts;
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use Snowflake\Error\Logger;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Error\Logger;
|
||||
use Kiri\Kiri;
|
||||
use Swoole\Coroutine;
|
||||
|
||||
/**
|
||||
* Class BaseObject
|
||||
* @package Snowflake\Snowflake\Base
|
||||
* @package Kiri\Kiri\Base
|
||||
*/
|
||||
class BaseObject implements Configure
|
||||
{
|
||||
@@ -31,7 +31,7 @@ class BaseObject implements Configure
|
||||
public function __construct(array $config = [])
|
||||
{
|
||||
if (!empty($config) && is_array($config)) {
|
||||
Snowflake::configure($this, $config);
|
||||
Kiri::configure($this, $config);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ class BaseObject implements Configure
|
||||
*/
|
||||
private function logger(): Logger
|
||||
{
|
||||
return Snowflake::app()->getLogger();
|
||||
return Kiri::app()->getLogger();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Abstracts;
|
||||
namespace Kiri\Abstracts;
|
||||
|
||||
|
||||
abstract class Command extends Component
|
||||
|
||||
@@ -7,18 +7,18 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Abstracts;
|
||||
namespace Kiri\Abstracts;
|
||||
|
||||
|
||||
use Exception;
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use Snowflake\Exception\ComponentException;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Exception\ComponentException;
|
||||
use Kiri\Kiri;
|
||||
|
||||
/**
|
||||
* Class Component
|
||||
* @package Snowflake\Snowflake\Base
|
||||
* @package Kiri\Kiri\Base
|
||||
*/
|
||||
class Component extends BaseObject
|
||||
{
|
||||
|
||||
@@ -7,16 +7,16 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Abstracts;
|
||||
namespace Kiri\Abstracts;
|
||||
|
||||
use Exception;
|
||||
use Snowflake\Exception\ConfigException;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use Kiri\Kiri;
|
||||
|
||||
|
||||
/**
|
||||
* Class Config
|
||||
* @package Snowflake\Snowflake\Base
|
||||
* @package Kiri\Kiri\Base
|
||||
*/
|
||||
class Config extends Component
|
||||
{
|
||||
@@ -52,7 +52,7 @@ class Config extends Component
|
||||
*/
|
||||
public static function sets(array $configs)
|
||||
{
|
||||
$config = Snowflake::app()->getConfig();
|
||||
$config = Kiri::app()->getConfig();
|
||||
if (empty($configs)) {
|
||||
return;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ class Config extends Component
|
||||
*/
|
||||
public static function get($key, mixed $default = null, bool $try = FALSE): mixed
|
||||
{
|
||||
$instance = Snowflake::app()->getConfig()->getData();
|
||||
$instance = Kiri::app()->getConfig()->getData();
|
||||
if (!str_contains($key, '.')) {
|
||||
return $instance[$key] ?? $default;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ class Config extends Component
|
||||
*/
|
||||
public static function set($key, $value): mixed
|
||||
{
|
||||
$config = Snowflake::app()->getConfig();
|
||||
$config = Kiri::app()->getConfig();
|
||||
return $config->setData($key, $value);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ class Config extends Component
|
||||
*/
|
||||
public static function has($key, bool $must_not_null = false): bool
|
||||
{
|
||||
$config = Snowflake::app()->getConfig();
|
||||
$config = Kiri::app()->getConfig();
|
||||
if (!isset($config->data[$key])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
* Time: 14:11
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
namespace Snowflake\Abstracts;
|
||||
namespace Kiri\Abstracts;
|
||||
|
||||
/**
|
||||
* Interface Configure
|
||||
* @package Snowflake\Snowflake\Base
|
||||
* @package Kiri\Kiri\Base
|
||||
*/
|
||||
interface Configure
|
||||
{
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Abstracts;
|
||||
namespace Kiri\Abstracts;
|
||||
|
||||
|
||||
use Snowflake\Core\Dtl;
|
||||
use Kiri\Core\Dtl;
|
||||
|
||||
|
||||
/**
|
||||
* Interface IListener
|
||||
* @package Snowflake\Abstracts
|
||||
* @package Kiri\Abstracts
|
||||
*/
|
||||
interface IListener
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Abstracts;
|
||||
namespace Kiri\Abstracts;
|
||||
|
||||
|
||||
use Exception;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake\Abstracts;
|
||||
namespace Kiri\Abstracts;
|
||||
|
||||
|
||||
interface Kernel
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Abstracts;
|
||||
namespace Kiri\Abstracts;
|
||||
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class Listener
|
||||
* @package Snowflake\Abstracts
|
||||
* @package Kiri\Abstracts
|
||||
* 监听的名称
|
||||
*/
|
||||
abstract class Listener extends Component implements IListener
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Abstracts;
|
||||
namespace Kiri\Abstracts;
|
||||
|
||||
|
||||
use Snowflake\Application;
|
||||
use Kiri\Application;
|
||||
|
||||
interface Provider
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Abstracts;
|
||||
namespace Kiri\Abstracts;
|
||||
|
||||
|
||||
/**
|
||||
* Class Providers
|
||||
* @package Snowflake\Abstracts
|
||||
* @package Kiri\Abstracts
|
||||
*/
|
||||
abstract class Providers extends Component implements Provider
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake\Abstracts;
|
||||
namespace Kiri\Abstracts;
|
||||
|
||||
|
||||
use Annotation\Annotation as SAnnotation;
|
||||
@@ -16,17 +16,17 @@ use HttpServer\Route\Router;
|
||||
use HttpServer\Server;
|
||||
use HttpServer\Shutdown;
|
||||
use Rpc\Producer as RPCProducer;
|
||||
use Snowflake\Async;
|
||||
use Snowflake\Cache\Redis;
|
||||
use Snowflake\Error\Logger;
|
||||
use Snowflake\Event;
|
||||
use Snowflake\Jwt\Jwt;
|
||||
use Snowflake\Pool\Connection;
|
||||
use Snowflake\Pool\Pool;
|
||||
use Kiri\Async;
|
||||
use Kiri\Cache\Redis;
|
||||
use Kiri\Error\Logger;
|
||||
use Kiri\Event;
|
||||
use Kiri\Jwt\Jwt;
|
||||
use Kiri\Pool\Connection;
|
||||
use Kiri\Pool\Pool;
|
||||
|
||||
/**
|
||||
* Trait TraitApplication
|
||||
* @package Snowflake\Abstracts
|
||||
* @package Kiri\Abstracts
|
||||
* @property Event $event
|
||||
* @property Router $router
|
||||
* @property \Redis|Redis $redis
|
||||
@@ -43,7 +43,7 @@ use Snowflake\Pool\Pool;
|
||||
* @property Client $client
|
||||
* @property \Database\Connection $databases
|
||||
* @property Curl $curl
|
||||
* @property \Snowflake\Crontab\Producer $crontab
|
||||
* @property \Kiri\Crontab\Producer $crontab
|
||||
* @property HttpFilter $filter
|
||||
* @property RPCProducer $rpc
|
||||
* @property Shutdown $shutdown
|
||||
|
||||
+5
-5
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake;
|
||||
namespace Kiri;
|
||||
|
||||
|
||||
use Exception;
|
||||
use ReflectionException;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Kiri\Abstracts\Component;
|
||||
|
||||
defined('ASPECT_ERROR') or define('ASPECT_ERROR', 'Aspect annotation must implement ');
|
||||
|
||||
|
||||
/**
|
||||
* Class Aop
|
||||
* @package Snowflake
|
||||
* @package Kiri
|
||||
*/
|
||||
class Aop extends Component
|
||||
{
|
||||
@@ -61,7 +61,7 @@ class Aop extends Component
|
||||
{
|
||||
$aopName = $handler[0]::class . '::' . $handler[1];
|
||||
|
||||
$reflect = Snowflake::getDi()->getReflect(current(static::$_aop[$aopName]));
|
||||
$reflect = Kiri::getDi()->getReflect(current(static::$_aop[$aopName]));
|
||||
if (!$reflect->isInstantiable() || !$reflect->hasMethod('invoke')) {
|
||||
throw new Exception(ASPECT_ERROR . IAspect::class);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ class Aop extends Component
|
||||
{
|
||||
$aopName = $handler[0]::class . '::' . $handler[1];
|
||||
|
||||
$reflect = Snowflake::getDi()->get(current(static::$_aop[$aopName]));
|
||||
$reflect = Kiri::getDi()->get(current(static::$_aop[$aopName]));
|
||||
if (!method_exists($reflect, 'invoke')) {
|
||||
throw new Exception(ASPECT_ERROR . IAspect::class);
|
||||
}
|
||||
|
||||
+10
-10
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake;
|
||||
namespace Kiri;
|
||||
|
||||
|
||||
use Closure;
|
||||
@@ -18,19 +18,19 @@ use Exception;
|
||||
use HttpServer\Command;
|
||||
use HttpServer\Http\Response;
|
||||
use HttpServer\ServerProviders;
|
||||
use Snowflake\Abstracts\BaseApplication;
|
||||
use Snowflake\Abstracts\Config;
|
||||
use Snowflake\Abstracts\Input;
|
||||
use Snowflake\Abstracts\Kernel;
|
||||
use Snowflake\Crontab\CrontabProviders;
|
||||
use Snowflake\Exception\NotFindClassException;
|
||||
use Kiri\Abstracts\BaseApplication;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Abstracts\Input;
|
||||
use Kiri\Abstracts\Kernel;
|
||||
use Kiri\Crontab\CrontabProviders;
|
||||
use Kiri\Exception\NotFindClassException;
|
||||
use stdClass;
|
||||
use Swoole\Timer;
|
||||
|
||||
/**
|
||||
* Class Init
|
||||
*
|
||||
* @package Snowflake
|
||||
* @package Kiri
|
||||
*
|
||||
* @property-read Config $config
|
||||
*/
|
||||
@@ -96,7 +96,7 @@ class Application extends BaseApplication
|
||||
if (!class_exists($service)) {
|
||||
throw new NotFindClassException($service);
|
||||
}
|
||||
$class = Snowflake::getDi()->get($service);
|
||||
$class = Kiri::getDi()->get($service);
|
||||
if (method_exists($class, 'onImport')) {
|
||||
$class->onImport($this);
|
||||
}
|
||||
@@ -138,7 +138,7 @@ class Application extends BaseApplication
|
||||
{
|
||||
try {
|
||||
/** @var Console $manager */
|
||||
$manager = Snowflake::app()->get('console');
|
||||
$manager = Kiri::app()->get('console');
|
||||
$manager->register(Runtime::class);
|
||||
$class = $manager->setParameters($argv)->search();
|
||||
if (!($class instanceof Command)) {
|
||||
|
||||
+5
-5
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake;
|
||||
namespace Kiri;
|
||||
|
||||
|
||||
use Exception;
|
||||
use HttpServer\IInterface\Task;
|
||||
use ReflectionException;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Kiri\Abstracts\Component;
|
||||
|
||||
/**
|
||||
* Class Async
|
||||
* @package Snowflake
|
||||
* @package Kiri
|
||||
*/
|
||||
class Async extends Component
|
||||
{
|
||||
@@ -37,7 +37,7 @@ class Async extends Component
|
||||
*/
|
||||
public function dispatch(string $name, array $params = [])
|
||||
{
|
||||
$server = Snowflake::app()->getSwoole();
|
||||
$server = Kiri::app()->getSwoole();
|
||||
if (!isset($server->setting['task_worker_num'])) {
|
||||
return;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ class Async extends Component
|
||||
}
|
||||
|
||||
/** @var Task $class */
|
||||
$class = Snowflake::createObject(static::$_absences[$name]);
|
||||
$class = Kiri::createObject(static::$_absences[$name]);
|
||||
$class->setParams($params);
|
||||
|
||||
$randWorkerId = random_int(0, $server->setting['task_worker_num'] - 1);
|
||||
|
||||
@@ -7,18 +7,18 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Cache;
|
||||
namespace Kiri\Cache;
|
||||
|
||||
|
||||
use Exception;
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Kiri\Abstracts\Component;
|
||||
use Swoole\Coroutine\System;
|
||||
|
||||
/**
|
||||
* Class File
|
||||
* @package Snowflake\Snowflake\Cache
|
||||
* @package Kiri\Kiri\Cache
|
||||
*/
|
||||
class File extends Component implements ICache
|
||||
{
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Cache;
|
||||
namespace Kiri\Cache;
|
||||
|
||||
/**
|
||||
* Interface ICache
|
||||
* @package Snowflake\Snowflake\Cache
|
||||
* @package Kiri\Kiri\Cache
|
||||
*/
|
||||
interface ICache
|
||||
{
|
||||
|
||||
+13
-13
@@ -7,23 +7,23 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Cache;
|
||||
namespace Kiri\Cache;
|
||||
|
||||
use Annotation\Inject;
|
||||
use Exception;
|
||||
use Server\Events\OnWorkerExit;
|
||||
use Server\Events\OnWorkerStop;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Snowflake\Abstracts\Config;
|
||||
use Snowflake\Core\Json;
|
||||
use Snowflake\Events\EventProvider;
|
||||
use Snowflake\Exception\ConfigException;
|
||||
use Snowflake\Snowflake;
|
||||
use Snowflake\Pool\Redis as PoolRedis;
|
||||
use Kiri\Abstracts\Component;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Core\Json;
|
||||
use Kiri\Events\EventProvider;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use Kiri\Kiri;
|
||||
use Kiri\Pool\Redis as PoolRedis;
|
||||
|
||||
/**
|
||||
* Class Redis
|
||||
* @package Snowflake\Snowflake\Cache
|
||||
* @package Kiri\Kiri\Cache
|
||||
* @mixin \Redis
|
||||
*/
|
||||
class Redis extends Component
|
||||
@@ -42,7 +42,7 @@ class Redis extends Component
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$connections = Snowflake::getDi()->get(PoolRedis::class);
|
||||
$connections = Kiri::getDi()->get(PoolRedis::class);
|
||||
|
||||
$config = $this->get_config();
|
||||
|
||||
@@ -114,7 +114,7 @@ SCRIPT;
|
||||
*/
|
||||
public function release()
|
||||
{
|
||||
$connections = Snowflake::getDi()->get(PoolRedis::class);
|
||||
$connections = Kiri::getDi()->get(PoolRedis::class);
|
||||
$connections->release($this->get_config(), true);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ SCRIPT;
|
||||
*/
|
||||
public function destroy()
|
||||
{
|
||||
$connections = Snowflake::getDi()->get(PoolRedis::class);
|
||||
$connections = Kiri::getDi()->get(PoolRedis::class);
|
||||
$connections->destroy($this->get_config(), true);
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ SCRIPT;
|
||||
*/
|
||||
public function proxy(): \Redis
|
||||
{
|
||||
$connections = Snowflake::getDi()->get(PoolRedis::class);
|
||||
$connections = Kiri::getDi()->get(PoolRedis::class);
|
||||
|
||||
$config = $this->get_config();
|
||||
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Core;
|
||||
namespace Kiri\Core;
|
||||
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class ArrayAccess
|
||||
* @package Snowflake\Core
|
||||
* @package Kiri\Core
|
||||
*/
|
||||
class ArrayAccess
|
||||
{
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Core;
|
||||
namespace Kiri\Core;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class DateFormat
|
||||
* @package Snowflake\Snowflake\Core
|
||||
* @package Kiri\Kiri\Core
|
||||
*/
|
||||
class DateFormat
|
||||
{
|
||||
|
||||
+3
-3
@@ -2,15 +2,15 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Snowflake\Core;
|
||||
namespace Kiri\Core;
|
||||
|
||||
|
||||
use Exception;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Kiri\Abstracts\Component;
|
||||
|
||||
/**
|
||||
* Class Dtl
|
||||
* @package Snowflake\Core
|
||||
* @package Kiri\Core
|
||||
*/
|
||||
class Dtl extends Component
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Snowflake\Core;
|
||||
namespace Kiri\Core;
|
||||
|
||||
|
||||
use Exception;
|
||||
@@ -10,7 +10,7 @@ use Exception;
|
||||
|
||||
/**
|
||||
* Class Help
|
||||
* @package Snowflake\Snowflake\Core
|
||||
* @package Kiri\Kiri\Core
|
||||
*/
|
||||
class Help
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Core;
|
||||
namespace Kiri\Core;
|
||||
|
||||
use Error;
|
||||
use Exception;
|
||||
@@ -16,7 +16,7 @@ use Throwable;
|
||||
|
||||
/**
|
||||
* Class JSON
|
||||
* @package Snowflake\Snowflake\Core
|
||||
* @package Kiri\Kiri\Core
|
||||
*/
|
||||
class Json
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake\Core;
|
||||
namespace Kiri\Core;
|
||||
|
||||
|
||||
class Number
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Snowflake\Core;
|
||||
namespace Kiri\Core;
|
||||
|
||||
/**
|
||||
* Class Reader
|
||||
* @package Snowflake\Snowflake\Core
|
||||
* @package Kiri\Kiri\Core
|
||||
*/
|
||||
class Reader
|
||||
{
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Core;
|
||||
namespace Kiri\Core;
|
||||
|
||||
|
||||
use Exception;
|
||||
@@ -9,7 +9,7 @@ use Exception;
|
||||
|
||||
/**
|
||||
* Class Str
|
||||
* @package Snowflake\Snowflake\Core
|
||||
* @package Kiri\Kiri\Core
|
||||
*/
|
||||
class Str
|
||||
{
|
||||
|
||||
+2
-2
@@ -7,11 +7,11 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Core;
|
||||
namespace Kiri\Core;
|
||||
|
||||
/**
|
||||
* Class Xml
|
||||
* @package Snowflake\Snowflake\Core
|
||||
* @package Kiri\Kiri\Core
|
||||
*/
|
||||
class Xml
|
||||
{
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake\Crontab;
|
||||
namespace Kiri\Crontab;
|
||||
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use Server\SInterface\PipeMessage;
|
||||
use Snowflake\Application;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Application;
|
||||
use Kiri\Kiri;
|
||||
use Swoole\Timer;
|
||||
|
||||
/**
|
||||
* Class Async
|
||||
* @package Snowflake
|
||||
* @package Kiri
|
||||
* @property Application $application
|
||||
*/
|
||||
abstract class Crontab implements PipeMessage, CrontabInterface
|
||||
@@ -62,7 +62,7 @@ abstract class Crontab implements PipeMessage, CrontabInterface
|
||||
*/
|
||||
#[Pure] private function getApplication(): Application
|
||||
{
|
||||
return Snowflake::app();
|
||||
return Kiri::app();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Snowflake\Crontab;
|
||||
namespace Kiri\Crontab;
|
||||
|
||||
interface CrontabInterface
|
||||
{
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake\Crontab;
|
||||
namespace Kiri\Crontab;
|
||||
|
||||
|
||||
use Exception;
|
||||
use ReflectionException;
|
||||
use Snowflake\Abstracts\Config;
|
||||
use Snowflake\Abstracts\Providers;
|
||||
use Snowflake\Application;
|
||||
use Snowflake\Exception\ComponentException;
|
||||
use Snowflake\Exception\ConfigException;
|
||||
use Snowflake\Exception\NotFindClassException;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Abstracts\Providers;
|
||||
use Kiri\Application;
|
||||
use Kiri\Exception\ComponentException;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use Kiri\Exception\NotFindClassException;
|
||||
|
||||
|
||||
/**
|
||||
* Class CrontabProviders
|
||||
* @package Snowflake\Crontab
|
||||
* @package Kiri\Crontab
|
||||
*/
|
||||
class CrontabProviders extends Providers
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake\Crontab;
|
||||
namespace Kiri\Crontab;
|
||||
|
||||
|
||||
/**
|
||||
* Class DefaultCrontab
|
||||
* @package Snowflake\Crontab
|
||||
* @package Kiri\Crontab
|
||||
*/
|
||||
class DefaultCrontab extends Crontab
|
||||
{
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake\Crontab;
|
||||
namespace Kiri\Crontab;
|
||||
|
||||
|
||||
use Exception;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Abstracts\Component;
|
||||
use Kiri\Kiri;
|
||||
|
||||
|
||||
/**
|
||||
* Class Producer
|
||||
* @package Snowflake\Abstracts
|
||||
* @package Kiri\Abstracts
|
||||
*/
|
||||
class Producer extends Component
|
||||
{
|
||||
@@ -25,7 +25,7 @@ class Producer extends Component
|
||||
*/
|
||||
public function dispatch(Crontab $crontab)
|
||||
{
|
||||
$redis = Snowflake::app()->getRedis();
|
||||
$redis = Kiri::app()->getRedis();
|
||||
|
||||
$name = $crontab->getName();
|
||||
if ($redis->exists(self::CRONTAB_KEY) && $redis->type(self::CRONTAB_KEY) !== \Redis::REDIS_ZSET) {
|
||||
@@ -48,7 +48,7 @@ class Producer extends Component
|
||||
*/
|
||||
public function clear(string $name)
|
||||
{
|
||||
$redis = Snowflake::app()->getRedis();
|
||||
$redis = Kiri::app()->getRedis();
|
||||
|
||||
$redis->del('crontab:' . md5($name));
|
||||
$redis->zRem(static::CRONTAB_KEY, md5($name));
|
||||
@@ -64,7 +64,7 @@ class Producer extends Component
|
||||
*/
|
||||
public function exists(string $name): bool
|
||||
{
|
||||
$redis = Snowflake::app()->getRedis();
|
||||
$redis = Kiri::app()->getRedis();
|
||||
if ($redis->exists('crontab:' . md5($name))) {
|
||||
return true;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class Producer extends Component
|
||||
*/
|
||||
public function clearAll()
|
||||
{
|
||||
$redis = Snowflake::app()->getRedis();
|
||||
$redis = Kiri::app()->getRedis();
|
||||
$data = $redis->zRange(self::CRONTAB_KEY, 0, -1);
|
||||
foreach ($data as $datum) {
|
||||
$redis->setex('stop:crontab:' . $datum, 120, 1);
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake\Crontab;
|
||||
namespace Kiri\Crontab;
|
||||
|
||||
|
||||
use Exception;
|
||||
use Server\ServerManager;
|
||||
use Server\SInterface\CustomProcess;
|
||||
use Snowflake\Abstracts\Config;
|
||||
use Snowflake\Cache\Redis;
|
||||
use Snowflake\Exception\ConfigException;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Cache\Redis;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use Kiri\Kiri;
|
||||
use Swoole\Process;
|
||||
use Swoole\Timer;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class Zookeeper
|
||||
* @package Snowflake\Process
|
||||
* @package Kiri\Process
|
||||
*/
|
||||
class Zookeeper implements CustomProcess
|
||||
{
|
||||
@@ -57,7 +57,7 @@ class Zookeeper implements CustomProcess
|
||||
*/
|
||||
public function loop()
|
||||
{
|
||||
$redis = Snowflake::app()->getRedis();
|
||||
$redis = Kiri::app()->getRedis();
|
||||
defer(fn() => $redis->release());
|
||||
$range = $this->loadCarobTask($redis);
|
||||
foreach ($range as $value) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Snowflake\Di;
|
||||
namespace Kiri\Di;
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use ReflectionClass;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Di;
|
||||
namespace Kiri\Di;
|
||||
|
||||
use Annotation\Inject;
|
||||
use Exception;
|
||||
@@ -16,13 +16,13 @@ use ReflectionException;
|
||||
use ReflectionFunction;
|
||||
use ReflectionMethod;
|
||||
use ReflectionProperty;
|
||||
use Snowflake\Abstracts\BaseObject;
|
||||
use Snowflake\Exception\NotFindClassException;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Abstracts\BaseObject;
|
||||
use Kiri\Exception\NotFindClassException;
|
||||
use Kiri\Kiri;
|
||||
|
||||
/**
|
||||
* Class Container
|
||||
* @package Snowflake\Di
|
||||
* @package Kiri\Di
|
||||
*/
|
||||
class Container extends BaseObject
|
||||
{
|
||||
@@ -198,7 +198,7 @@ class Container extends BaseObject
|
||||
*/
|
||||
private function onAfterInit($object, $config): mixed
|
||||
{
|
||||
Snowflake::configure($object, $config);
|
||||
Kiri::configure($object, $config);
|
||||
if (method_exists($object, 'init')) {
|
||||
call_user_func([$object, 'init']);
|
||||
}
|
||||
@@ -331,7 +331,7 @@ class Container extends BaseObject
|
||||
} else {
|
||||
$type = $parameter->getType()->getName();
|
||||
if (is_string($type) && class_exists($type)) {
|
||||
$type = Snowflake::getDi()->get($type);
|
||||
$type = Kiri::getDi()->get($type);
|
||||
}
|
||||
$params[$key] = match ($parameter->getType()) {
|
||||
'string' => '',
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Snowflake\Di;
|
||||
namespace Kiri\Di;
|
||||
|
||||
use Annotation\Inject;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Abstracts\Component;
|
||||
use Kiri\Kiri;
|
||||
|
||||
|
||||
/**
|
||||
@@ -45,7 +45,7 @@ class LocalService extends Component
|
||||
if (is_object($definition) && !$definition instanceof \Closure) {
|
||||
return $this->_components[$name] = $definition;
|
||||
}
|
||||
return $this->_components[$name] = Snowflake::createObject($definition);
|
||||
return $this->_components[$name] = Kiri::createObject($definition);
|
||||
} else if ($throwException) {
|
||||
throw new \Exception("Unknown component ID: $name");
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake;
|
||||
namespace Kiri;
|
||||
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
@@ -9,7 +9,7 @@ use JetBrains\PhpStorm\Pure;
|
||||
|
||||
/**
|
||||
* Class Environmental
|
||||
* @package Snowflake
|
||||
* @package Kiri
|
||||
*/
|
||||
class Environmental
|
||||
{
|
||||
|
||||
@@ -7,19 +7,19 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Error;
|
||||
namespace Kiri\Error;
|
||||
|
||||
use Exception;
|
||||
use HttpServer\IInterface\IFormatter;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Snowflake\Core\Json;
|
||||
use Snowflake\Event;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Abstracts\Component;
|
||||
use Kiri\Core\Json;
|
||||
use Kiri\Event;
|
||||
use Kiri\Kiri;
|
||||
|
||||
/**
|
||||
* Class ErrorHandler
|
||||
*
|
||||
* @package Snowflake\Snowflake\Base
|
||||
* @package Kiri\Kiri\Base
|
||||
* @property-read $asError
|
||||
*/
|
||||
class ErrorHandler extends Component implements ErrorInterface
|
||||
@@ -97,7 +97,7 @@ class ErrorHandler extends Component implements ErrorInterface
|
||||
|
||||
$data = Json::to(500, $error[1], $path);
|
||||
|
||||
Snowflake::app()->error($data, 'error');
|
||||
Kiri::app()->error($data, 'error');
|
||||
|
||||
Event::trigger(Event::SYSTEM_RESOURCE_CLEAN);
|
||||
|
||||
@@ -149,6 +149,6 @@ class ErrorHandler extends Component implements ErrorInterface
|
||||
*/
|
||||
public function writer($message, string $category = 'app')
|
||||
{
|
||||
Snowflake::app()->debug($message, $category);
|
||||
Kiri::app()->debug($message, $category);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Error;
|
||||
namespace Kiri\Error;
|
||||
|
||||
/**
|
||||
* Interface ErrorInterface
|
||||
* @package Snowflake\Snowflake\Error
|
||||
* @package Kiri\Kiri\Error
|
||||
*/
|
||||
interface ErrorInterface
|
||||
{
|
||||
|
||||
@@ -7,23 +7,23 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Error;
|
||||
namespace Kiri\Error;
|
||||
|
||||
use Annotation\Inject;
|
||||
use Exception;
|
||||
use Server\Events\OnAfterRequest;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Snowflake\Abstracts\Config;
|
||||
use Snowflake\Core\Json;
|
||||
use Snowflake\Events\EventProvider;
|
||||
use Snowflake\Exception\ConfigException;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Abstracts\Component;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Core\Json;
|
||||
use Kiri\Events\EventProvider;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use Kiri\Kiri;
|
||||
use Swoole\Coroutine;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Class Logger
|
||||
* @package Snowflake\Snowflake\Error
|
||||
* @package Kiri\Kiri\Error
|
||||
*/
|
||||
class Logger extends Component
|
||||
{
|
||||
@@ -263,7 +263,7 @@ class Logger extends Component
|
||||
{
|
||||
$code = $exception->getCode() == 0 ? 500 : $exception->getCode();
|
||||
|
||||
$logger = Snowflake::app()->getLogger();
|
||||
$logger = Kiri::app()->getLogger();
|
||||
$logger->write(jTraceEx($exception), 'exception');
|
||||
|
||||
return Json::to($code, $exception->getMessage(), [
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake\Error;
|
||||
namespace Kiri\Error;
|
||||
|
||||
|
||||
use Snowflake\IAspect;
|
||||
use Kiri\IAspect;
|
||||
|
||||
|
||||
/**
|
||||
* Class LoggerAspect
|
||||
* @package Snowflake\Error
|
||||
* @package Kiri\Error
|
||||
*/
|
||||
class LoggerAspect implements IAspect
|
||||
{
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake\Error;
|
||||
namespace Kiri\Error;
|
||||
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use Server\SInterface\CustomProcess;
|
||||
use Snowflake\Core\Json;
|
||||
use Snowflake\Exception\ComponentException;
|
||||
use Snowflake\Process\Process;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Core\Json;
|
||||
use Kiri\Exception\ComponentException;
|
||||
use Kiri\Process\Process;
|
||||
use Kiri\Kiri;
|
||||
use Swoole\Coroutine;
|
||||
|
||||
|
||||
/**
|
||||
* Class LoggerProcess
|
||||
* @package Snowflake\Error
|
||||
* @package Kiri\Error
|
||||
*/
|
||||
class LoggerProcess implements CustomProcess
|
||||
{
|
||||
@@ -51,7 +51,7 @@ class LoggerProcess implements CustomProcess
|
||||
{
|
||||
$message = Json::decode($process->read());
|
||||
if (!empty($message)) {
|
||||
Snowflake::writeFile($this->getDirName($message), $message[0], FILE_APPEND);
|
||||
Kiri::writeFile($this->getDirName($message), $message[0], FILE_APPEND);
|
||||
|
||||
$this->checkLogFile($message[1]);
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,16 +2,16 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Snowflake;
|
||||
namespace Kiri;
|
||||
|
||||
|
||||
use Exception;
|
||||
use Snowflake\Abstracts\BaseObject;
|
||||
use Kiri\Abstracts\BaseObject;
|
||||
use Swoole\Coroutine;
|
||||
|
||||
/**
|
||||
* Class Event
|
||||
* @package Snowflake
|
||||
* @package Kiri
|
||||
*/
|
||||
class Event extends BaseObject
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Snowflake\Events;
|
||||
namespace Kiri\Events;
|
||||
|
||||
use Annotation\Inject;
|
||||
use Snowflake\Abstracts\BaseObject;
|
||||
use Kiri\Abstracts\BaseObject;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Snowflake\Events;
|
||||
namespace Kiri\Events;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Snowflake\Events;
|
||||
namespace Kiri\Events;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Snowflake\Events;
|
||||
namespace Kiri\Events;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Snowflake\Events;
|
||||
namespace Kiri\Events;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Events;
|
||||
namespace Kiri\Events;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Snowflake\Exception;
|
||||
namespace Kiri\Exception;
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ use Throwable;
|
||||
|
||||
/**
|
||||
* Class AuthException
|
||||
* @package Snowflake\Exception
|
||||
* @package Kiri\Exception
|
||||
*/
|
||||
class AuthException extends \Exception
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Exception;
|
||||
namespace Kiri\Exception;
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ use Throwable;
|
||||
|
||||
/**
|
||||
* Class ComponentException
|
||||
* @package Snowflake\Snowflake\Exception
|
||||
* @package Kiri\Kiri\Exception
|
||||
*/
|
||||
class ComponentException extends \Exception
|
||||
{
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Snowflake\Exception;
|
||||
namespace Kiri\Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Class ConfigException
|
||||
* @package Snowflake\Exception
|
||||
* @package Kiri\Exception
|
||||
*/
|
||||
class ConfigException extends \Exception
|
||||
{
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Exception;
|
||||
namespace Kiri\Exception;
|
||||
|
||||
/**
|
||||
* Class InitException
|
||||
* @package Snowflake\Exception
|
||||
* @package Kiri\Exception
|
||||
*/
|
||||
class InitException extends \Exception
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Exception;
|
||||
namespace Kiri\Exception;
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ use Throwable;
|
||||
|
||||
/**
|
||||
* Class NotFindClassException
|
||||
* @package Snowflake\Snowflake\Exception
|
||||
* @package Kiri\Kiri\Exception
|
||||
*/
|
||||
class NotFindClassException extends \Exception
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Exception;
|
||||
namespace Kiri\Exception;
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ use Throwable;
|
||||
|
||||
/**
|
||||
* Class NotFindClassException
|
||||
* @package Snowflake\Snowflake\Exception
|
||||
* @package Kiri\Kiri\Exception
|
||||
*/
|
||||
class NotFindPropertyException extends \Exception
|
||||
{
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Snowflake\Exception;
|
||||
namespace Kiri\Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Class RedisConnectException
|
||||
* @package Snowflake\Exception
|
||||
* @package Kiri\Exception
|
||||
*/
|
||||
class RedisConnectException extends \Exception
|
||||
{
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake;
|
||||
namespace Kiri;
|
||||
|
||||
|
||||
interface IAspect
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake;
|
||||
namespace Kiri;
|
||||
|
||||
|
||||
interface IProxy
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Snowflake\Jwt;
|
||||
namespace Kiri\Jwt;
|
||||
|
||||
|
||||
use Closure;
|
||||
@@ -10,11 +10,11 @@ use Exception;
|
||||
use HttpServer\Http\Request;
|
||||
use HttpServer\IInterface\Middleware;
|
||||
use Server\RequestInterface;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Kiri;
|
||||
|
||||
/**
|
||||
* Class CoreMiddleware
|
||||
* @package Snowflake\Snowflake\Route
|
||||
* @package Kiri\Kiri\Route
|
||||
* 跨域中间件
|
||||
*/
|
||||
class JWTAuthMiddleware implements Middleware
|
||||
@@ -41,7 +41,7 @@ class JWTAuthMiddleware implements Middleware
|
||||
throw new JWTAuthTokenException('JWT Voucher Format Error.');
|
||||
}
|
||||
$authorization = str_replace('Bearer ', '', $authorization);
|
||||
$jwt = Snowflake::app()->getJwt();
|
||||
$jwt = Kiri::app()->getJwt();
|
||||
if (!$jwt->validator($authorization)) {
|
||||
throw new JWTAuthTokenException('JWT Validator fail.');
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Snowflake\Jwt;
|
||||
namespace Kiri\Jwt;
|
||||
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
+6
-6
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Jwt;
|
||||
namespace Kiri\Jwt;
|
||||
|
||||
use Exception;
|
||||
use Server\Constrict\Request;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Snowflake\Abstracts\Config;
|
||||
use Snowflake\Core\Json;
|
||||
use Snowflake\Exception\ConfigException;
|
||||
use Kiri\Abstracts\Component;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Core\Json;
|
||||
use Kiri\Exception\ConfigException;
|
||||
|
||||
|
||||
/**
|
||||
* Class Jwt
|
||||
* @package Snowflake\Jwt
|
||||
* @package Kiri\Jwt
|
||||
*/
|
||||
class Jwt extends Component
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Snowflake\Jwt;
|
||||
namespace Kiri\Jwt;
|
||||
|
||||
trait JwtHelper
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Snowflake\Pool;
|
||||
namespace Kiri\Pool;
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Pool;
|
||||
namespace Kiri\Pool;
|
||||
|
||||
use Closure;
|
||||
use Exception;
|
||||
use HttpServer\Http\Context;
|
||||
use PDO;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Abstracts\Component;
|
||||
use Kiri\Kiri;
|
||||
use Swoole\Coroutine;
|
||||
use Swoole\Error;
|
||||
use Swoole\Runtime;
|
||||
@@ -16,7 +16,7 @@ use Throwable;
|
||||
|
||||
/**
|
||||
* Class Connection
|
||||
* @package Snowflake\Pool
|
||||
* @package Kiri\Pool
|
||||
*/
|
||||
class Connection extends Component
|
||||
{
|
||||
@@ -229,7 +229,7 @@ class Connection extends Component
|
||||
*/
|
||||
public function getPool(): Pool
|
||||
{
|
||||
return Snowflake::getDi()->get(Pool::class);
|
||||
return Kiri::getDi()->get(Pool::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake\Pool;
|
||||
namespace Kiri\Pool;
|
||||
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Snowflake\Abstracts\Config;
|
||||
use Snowflake\Exception\ConfigException;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Abstracts\Component;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use Kiri\Kiri;
|
||||
use Swoole\Coroutine;
|
||||
use Swoole\Coroutine\Channel;
|
||||
use Swoole\Timer;
|
||||
@@ -17,7 +17,7 @@ use Swoole\Timer;
|
||||
|
||||
/**
|
||||
* Class Pool
|
||||
* @package Snowflake\Pool
|
||||
* @package Kiri\Pool
|
||||
*/
|
||||
class Pool extends Component
|
||||
{
|
||||
@@ -101,7 +101,7 @@ class Pool extends Component
|
||||
return;
|
||||
}
|
||||
Timer::clear($this->creates);
|
||||
if (Snowflake::isWorker() || Snowflake::isTask()) {
|
||||
if (Kiri::isWorker() || Kiri::isTask()) {
|
||||
$this->debug('Worker #' . env('worker') . ' clear time tick.');
|
||||
}
|
||||
$this->creates = -1;
|
||||
@@ -206,7 +206,7 @@ class Pool extends Component
|
||||
/**
|
||||
* @param $name
|
||||
* @return bool
|
||||
* @throws \Snowflake\Exception\ConfigException
|
||||
* @throws \Kiri\Exception\ConfigException
|
||||
*/
|
||||
public function isNull($name): bool
|
||||
{
|
||||
|
||||
@@ -2,22 +2,22 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Snowflake\Pool;
|
||||
namespace Kiri\Pool;
|
||||
|
||||
|
||||
use Exception;
|
||||
use HttpServer\Http\Context;
|
||||
use Redis as SRedis;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Snowflake\Exception\ConfigException;
|
||||
use Snowflake\Exception\RedisConnectException;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Abstracts\Component;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use Kiri\Exception\RedisConnectException;
|
||||
use Kiri\Kiri;
|
||||
use Swoole\Coroutine;
|
||||
use Swoole\Runtime;
|
||||
|
||||
/**
|
||||
* Class RedisClient
|
||||
* @package Snowflake\Snowflake\Pool
|
||||
* @package Kiri\Kiri\Pool
|
||||
*/
|
||||
class Redis extends Component
|
||||
{
|
||||
@@ -112,7 +112,7 @@ class Redis extends Component
|
||||
*/
|
||||
public function getPool(): Pool
|
||||
{
|
||||
return Snowflake::getDi()->get(Pool::class);
|
||||
return Kiri::getDi()->get(Pool::class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake\Process;
|
||||
namespace Kiri\Process;
|
||||
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use Server\SInterface\CustomProcess;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Kiri;
|
||||
use Swoole\Timer;
|
||||
|
||||
/**
|
||||
@@ -35,7 +35,7 @@ class Biomonitoring implements CustomProcess
|
||||
*/
|
||||
public function onHandler(\Swoole\Process $process): void
|
||||
{
|
||||
$server = Snowflake::app()->getSwoole();
|
||||
$server = Kiri::app()->getSwoole();
|
||||
Timer::tick(1000, function () use ($server) {
|
||||
clearstatcache();
|
||||
if (filesize($server->setting['log_file']) > 1024000000) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Snowflake\Process;
|
||||
namespace Kiri\Process;
|
||||
|
||||
|
||||
interface ISystem
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Snowflake\Process;
|
||||
namespace Kiri\Process;
|
||||
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use Snowflake\Event;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Event;
|
||||
use Kiri\Kiri;
|
||||
|
||||
/**
|
||||
* Class Process
|
||||
* @package Snowflake\Snowflake\Service
|
||||
* @package Kiri\Kiri\Service
|
||||
*/
|
||||
abstract class Process extends \Swoole\Process implements SProcess
|
||||
{
|
||||
@@ -36,12 +36,12 @@ abstract class Process extends \Swoole\Process implements SProcess
|
||||
*/
|
||||
public function _load(Process $process)
|
||||
{
|
||||
Snowflake::setProcessId($this->pid);
|
||||
Kiri::setProcessId($this->pid);
|
||||
|
||||
putenv('environmental=' . Snowflake::PROCESS);
|
||||
putenv('environmental=' . Kiri::PROCESS);
|
||||
|
||||
fire(Event::SERVER_WORKER_START);
|
||||
if (Snowflake::getPlatform()->isLinux()) {
|
||||
if (Kiri::getPlatform()->isLinux()) {
|
||||
name($this->pid, $this->getProcessName());
|
||||
}
|
||||
if (method_exists($this, 'before')) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake\Process;
|
||||
namespace Kiri\Process;
|
||||
|
||||
|
||||
interface SProcess
|
||||
|
||||
@@ -7,20 +7,20 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Process;
|
||||
namespace Kiri\Process;
|
||||
|
||||
|
||||
use Exception;
|
||||
use Server\SInterface\CustomProcess;
|
||||
use Snowflake\Abstracts\Config;
|
||||
use Snowflake\Exception\ConfigException;
|
||||
use Snowflake\Snowflake;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use Kiri\Kiri;
|
||||
use Swoole\Event;
|
||||
use Swoole\Timer;
|
||||
|
||||
/**
|
||||
* Class ServerInotify
|
||||
* @package Snowflake\Snowflake\Server
|
||||
* @package Kiri\Kiri\Server
|
||||
*/
|
||||
class ServerInotify implements CustomProcess
|
||||
{
|
||||
@@ -238,7 +238,7 @@ class ServerInotify implements CustomProcess
|
||||
|
||||
print_r(implode(PHP_EOL, $output));
|
||||
|
||||
Snowflake::reload();
|
||||
Kiri::reload();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake;
|
||||
namespace Kiri;
|
||||
|
||||
|
||||
class Proxy
|
||||
|
||||
+7
-7
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake;
|
||||
namespace Kiri;
|
||||
|
||||
|
||||
use Console\Command;
|
||||
use Exception;
|
||||
use Snowflake\Abstracts\Input;
|
||||
use Kiri\Abstracts\Input;
|
||||
|
||||
|
||||
/**
|
||||
* Class Runtime
|
||||
* @package Snowflake
|
||||
* @package Kiri
|
||||
*/
|
||||
class Runtime extends Command
|
||||
{
|
||||
@@ -34,13 +34,13 @@ class Runtime extends Command
|
||||
public function onHandler(Input $dtl): string
|
||||
{
|
||||
// TODO: Implement onHandler() method.
|
||||
$annotation = Snowflake::app()->getAnnotation();
|
||||
$annotation = Kiri::app()->getAnnotation();
|
||||
|
||||
$runtime = storage(static::CACHE_NAME);
|
||||
$config = storage(static::CONFIG_NAME);
|
||||
|
||||
Snowflake::writeFile($config, $this->configEach());
|
||||
Snowflake::writeFile($runtime, serialize($annotation->getLoader()));
|
||||
Kiri::writeFile($config, $this->configEach());
|
||||
Kiri::writeFile($runtime, serialize($annotation->getLoader()));
|
||||
|
||||
return 'ok';
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class Runtime extends Command
|
||||
public function configEach(): string
|
||||
{
|
||||
$array = [];
|
||||
$configs = Snowflake::app()->getConfig();
|
||||
$configs = Kiri::app()->getConfig();
|
||||
foreach ($configs->getData() as $key => $datum) {
|
||||
if ($datum instanceof \Closure) {
|
||||
continue;
|
||||
|
||||
+15
-15
@@ -2,7 +2,7 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Snowflake;
|
||||
namespace Kiri;
|
||||
|
||||
|
||||
use Annotation\Annotation;
|
||||
@@ -13,11 +13,11 @@ use HttpServer\IInterface\Task;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use ReflectionException;
|
||||
use ReflectionProperty;
|
||||
use Snowflake\Abstracts\Config;
|
||||
use Snowflake\Core\Json;
|
||||
use Snowflake\Di\Container;
|
||||
use Snowflake\Exception\NotFindClassException;
|
||||
use Snowflake\Process\Process;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Core\Json;
|
||||
use Kiri\Di\Container;
|
||||
use Kiri\Exception\NotFindClassException;
|
||||
use Kiri\Process\Process;
|
||||
use Swoole\Coroutine;
|
||||
use Swoole\WebSocket\Server;
|
||||
|
||||
@@ -37,10 +37,10 @@ defined('SOCKET_PATH') or define('SOCKET_PATH', APP_PATH . 'app/Websocket/');
|
||||
|
||||
|
||||
/**
|
||||
* Class Snowflake
|
||||
* @package Snowflake
|
||||
* Class Kiri
|
||||
* @package Kiri
|
||||
*/
|
||||
class Snowflake
|
||||
class Kiri
|
||||
{
|
||||
|
||||
/** @var Container */
|
||||
@@ -149,7 +149,7 @@ class Snowflake
|
||||
if (empty($port)) {
|
||||
return false;
|
||||
}
|
||||
if (Snowflake::getPlatform()->isLinux()) {
|
||||
if (Kiri::getPlatform()->isLinux()) {
|
||||
exec('netstat -tunlp | grep ' . $port, $output);
|
||||
} else {
|
||||
exec('lsof -i :' . $port . ' | grep -i "LISTEN"', $output);
|
||||
@@ -411,7 +411,7 @@ class Snowflake
|
||||
*/
|
||||
public static function getMasterPid(): bool|string
|
||||
{
|
||||
$pid = Snowflake::app()->getSwoole()->setting['pid_file'];
|
||||
$pid = Kiri::app()->getSwoole()->setting['pid_file'];
|
||||
|
||||
return file_get_contents($pid);
|
||||
}
|
||||
@@ -527,7 +527,7 @@ class Snowflake
|
||||
*/
|
||||
public static function getPlatform(): Environmental
|
||||
{
|
||||
return Snowflake::createObject(Environmental::class);
|
||||
return Kiri::createObject(Environmental::class);
|
||||
}
|
||||
|
||||
|
||||
@@ -537,7 +537,7 @@ class Snowflake
|
||||
*/
|
||||
public static function reload(): mixed
|
||||
{
|
||||
return Snowflake::app()->getSwoole()->reload();
|
||||
return Kiri::app()->getSwoole()->reload();
|
||||
}
|
||||
|
||||
|
||||
@@ -634,5 +634,5 @@ class Snowflake
|
||||
|
||||
}
|
||||
|
||||
//spl_autoload_register([Snowflake::class, 'autoload'], true, true);
|
||||
Snowflake::$container = new Container();
|
||||
//spl_autoload_register([Kiri::class, 'autoload'], true, true);
|
||||
Kiri::$container = new Container();
|
||||
|
||||
Reference in New Issue
Block a user