Removed useless word 'server'

This commit is contained in:
huangzhhui 2019-01-03 00:16:20 +08:00
parent bc4efc9849
commit 0b0c1f389b
6 changed files with 9 additions and 9 deletions

View File

@ -61,13 +61,13 @@ class Server
throw new \InvalidArgumentException('Server not exist.');
}
if (! $this->server) {
$serverName = $serverConfig['name'] ?? 'httpServer';
$serverName = $serverConfig['name'] ?? 'http';
$this->server = new $server(...$constructor);
$callbacks = array_replace($this->defaultCallbacks(), $callbacks);
$this->registerSwooleEvents($this->server, $callbacks, $serverName);
$this->server->set($settings);
} else {
$serverName = $serverConfig['name'] ?? 'httpServer' . $i;
$serverName = $serverConfig['name'] ?? 'http' . $i;
$slaveServer = $this->server->addlistener(...$constructor);
$this->registerSwooleEvents($slaveServer, $callbacks, $serverName);
}

View File

@ -27,7 +27,7 @@ class AutoController extends AbstractAnnotation
/**
* @var string
*/
public $server = 'httpServer';
public $server = 'http';
public function __construct($value = null)
{

View File

@ -27,7 +27,7 @@ class Controller extends AbstractAnnotation
/**
* @var string
*/
public $server = 'httpServer';
public $server = 'http';
public function __construct($value = null)
{

View File

@ -103,7 +103,7 @@ class DispatcherFactory
$class = ReflectionManager::reflectClass($className);
$methods = $class->getMethods(ReflectionMethod::IS_PUBLIC);
$prefix = $this->getPrefix($className, $values['prefix'] ?? '');
$router = $this->getRouter($values['server'] ?? 'httpServer');
$router = $this->getRouter($values['server'] ?? 'http');
foreach ($methods as $method) {
$path = $this->parsePath($prefix, $method);
@ -122,7 +122,7 @@ class DispatcherFactory
private function handleController(string $className, array $controllerMetadata, array $methodMetadata): void
{
$prefix = $this->getPrefix($className, $controllerMetadata['prefix'] ?? '');
$router = $this->getRouter($controllerMetadata['prefix'] ?? 'httpServer');
$router = $this->getRouter($controllerMetadata['prefix'] ?? 'http');
foreach ($methodMetadata as $method => $values) {
$mappingAnnotations = [

View File

@ -26,7 +26,7 @@ class Router
/**
* @var string
*/
protected static $serverName = 'httpServer';
protected static $serverName = 'http';
/**
* @var DispatcherFactory
@ -43,7 +43,7 @@ class Router
{
static::$serverName = $serverName;
call($callback);
static::$serverName = 'httpServer';
static::$serverName = 'http';
}
public static function init(DispatcherFactory $factory)

View File

@ -57,7 +57,7 @@ class Server implements ServerOnRequestInterface
/**
* @var string
*/
private $serverName = 'httpServer';
private $serverName = 'http';
public function __construct(
array $middlewares,