This commit is contained in:
2021-08-05 15:15:42 +08:00
parent 5f57b77a53
commit ba00de55cf
12 changed files with 244 additions and 176 deletions
+49 -63
View File
@@ -22,7 +22,6 @@ use HttpServer\Route\Router;
use HttpServer\Server;
use HttpServer\Shutdown;
use JetBrains\PhpStorm\Pure;
use Kafka\Producer;
use Kafka\KafkaProvider;
use ReflectionException;
use Server\ServerManager;
@@ -167,22 +166,22 @@ abstract class BaseApplication extends Component
}
/**
* @param $name
* @return mixed
* @throws \ReflectionException
* @throws \Snowflake\Exception\NotFindClassException
*/
/**
* @param $name
* @return mixed
* @throws \ReflectionException
* @throws \Snowflake\Exception\NotFindClassException
*/
public function __get($name): mixed
{
if ($this->has($name)) {
return $this->get($name);
}
return parent::__get($name); // TODO: Change the autogenerated stub
}
{
if ($this->has($name)) {
return $this->get($name);
}
return parent::__get($name); // TODO: Change the autogenerated stub
}
/**
/**
* @param $config
*
* @throws
@@ -262,17 +261,16 @@ abstract class BaseApplication extends Component
}
/**
* @param $name
* @return mixed
* @throws \ReflectionException
* @throws \Snowflake\Exception\NotFindClassException
*/
/**
* @param $name
* @return mixed
* @throws \ReflectionException
* @throws \Snowflake\Exception\NotFindClassException
*/
public function get($name): mixed
{
return di(Service::class)->get($name);
}
{
return di(Service::class)->get($name);
}
/**
@@ -302,16 +300,6 @@ abstract class BaseApplication extends Component
}
/**
* @return Producer
* @throws Exception
*/
public function getKafka(): Producer
{
return $this->get('kafka');
}
/**
* @return \Redis|Redis
* @throws Exception
@@ -461,41 +449,39 @@ abstract class BaseApplication extends Component
}
/**
* @param $array
* @throws \ReflectionException
* @throws \Snowflake\Exception\NotFindClassException
*/
/**
* @param $array
* @throws \ReflectionException
* @throws \Snowflake\Exception\NotFindClassException
*/
private function setComponents($array): void
{
di(Service::class)->setComponents($array);
}
{
di(Service::class)->setComponents($array);
}
/**
* @param $id
* @param $definition
* @throws \ReflectionException
* @throws \Snowflake\Exception\NotFindClassException
*/
/**
* @param $id
* @param $definition
* @throws \ReflectionException
* @throws \Snowflake\Exception\NotFindClassException
*/
public function set($id, $definition): void
{
di(Service::class)->set($id, $definition);
}
{
di(Service::class)->set($id, $definition);
}
/**
* @param $id
* @param $definition
* @throws \ReflectionException
* @throws \Snowflake\Exception\NotFindClassException
*/
/**
* @param $id
* @param $definition
* @throws \ReflectionException
* @throws \Snowflake\Exception\NotFindClassException
*/
public function has($id): bool
{
return di(Service::class)->has($id);
}
{
return di(Service::class)->has($id);
}
/**
@@ -514,7 +500,7 @@ abstract class BaseApplication extends Component
'router' => ['class' => Router::class],
'event' => ['class' => Event::class],
'redis' => ['class' => Redis::class],
'databases' => ['class' => \Database\Connection::class],
'databases' => ['class' => \Database\Connection::class],
'aop' => ['class' => Aop::class],
'input' => ['class' => HttpParams::class],
'header' => ['class' => HttpHeaders::class],
+2 -4
View File
@@ -6,8 +6,8 @@ namespace Snowflake\Abstracts;
use Annotation\Annotation as SAnnotation;
use Database\DatabasesProviders;
use HttpServer\Client\Client;
use HttpServer\Client\Curl;
use HttpServer\Client\Help\Client;
use HttpServer\Client\Help\Curl;
use HttpServer\Client\Http2;
use HttpServer\Http\Request;
use HttpServer\Http\Response;
@@ -15,7 +15,6 @@ use HttpServer\HttpFilter;
use HttpServer\Route\Router;
use HttpServer\Server;
use HttpServer\Shutdown;
use Kafka\Producer;
use Rpc\Producer as RPCProducer;
use Snowflake\Async;
use Snowflake\Cache\Redis;
@@ -42,7 +41,6 @@ use Snowflake\Pool\Pool;
* @property SAnnotation $annotation
* @property Http2 $http2
* @property BaseGoto $goto
* @property Producer $kafka
* @property Client $client
* @property \Database\Connection $databases
* @property Curl $curl