改名
This commit is contained in:
@@ -6,6 +6,8 @@ namespace Database;
|
||||
|
||||
use Exception;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Snowflake\Abstracts\Providers;
|
||||
use Snowflake\Application;
|
||||
use Snowflake\Config;
|
||||
use Snowflake\Exception\ConfigException;
|
||||
use Snowflake\Snowflake;
|
||||
@@ -14,10 +16,20 @@ use Snowflake\Snowflake;
|
||||
* Class DatabasesProviders
|
||||
* @package Database
|
||||
*/
|
||||
class DatabasesProviders extends Component
|
||||
class DatabasesProviders extends Providers
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param Application $application
|
||||
* @throws Exception
|
||||
*/
|
||||
public function onImport(Application $application)
|
||||
{
|
||||
$application->set('db', $this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @return DatabasesProviders
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace HttpServer;
|
||||
use Exception;
|
||||
use HttpServer\Server;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Snowflake\Abstracts\Providers;
|
||||
use Snowflake\Config;
|
||||
use Snowflake\Exception\ConfigException;
|
||||
use Snowflake\Snowflake;
|
||||
@@ -15,15 +16,17 @@ use Snowflake\Snowflake;
|
||||
* Class DatabasesProviders
|
||||
* @package Database
|
||||
*/
|
||||
class ServerProviders extends Component
|
||||
class ServerProviders extends Providers
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param \Snowflake\Application $application
|
||||
* @throws Exception
|
||||
*/
|
||||
public function onImport()
|
||||
public function onImport(\Snowflake\Application $application)
|
||||
{
|
||||
Snowflake::get()->set('server', [
|
||||
$application->set('server', [
|
||||
'class' => Server::class
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Snowflake\Abstracts;
|
||||
|
||||
|
||||
use Snowflake\Application;
|
||||
|
||||
/**
|
||||
* Class Providers
|
||||
* @package Snowflake\Abstracts
|
||||
*/
|
||||
abstract class Providers extends Component
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@@ -50,7 +50,7 @@ class Application extends BaseApplication
|
||||
if (!class_exists($service)) {
|
||||
throw new NotFindClassException($service);
|
||||
}
|
||||
$class = Snowflake::createObject($service);
|
||||
$class = Snowflake::createObject($service, [Snowflake::get()]);
|
||||
if (method_exists($class, 'onImport')) {
|
||||
$class->onImport($this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user