mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-05 05:07:58 +08:00
Add an abstraction PipeMessage class and uniform the PipeMessage class of all drivers
This commit is contained in:
parent
02d514427e
commit
8d1ab1fad5
@ -16,8 +16,6 @@ use Psr\Container\ContainerInterface;
|
||||
|
||||
class AliyunAcmDriver extends AbstractDriver
|
||||
{
|
||||
protected $pipeMessage = PipeMessage::class;
|
||||
|
||||
protected $driverName = 'aliyun_acm';
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\ConfigAliyunAcm;
|
||||
|
||||
use Hyperf\ConfigCenter\Contract\PipeMessageInterface;
|
||||
|
||||
class PipeMessage implements PipeMessageInterface
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $data;
|
||||
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function getData(): array
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
}
|
@ -23,8 +23,6 @@ class ApolloDriver extends AbstractDriver
|
||||
|
||||
protected $driverName = 'apollo';
|
||||
|
||||
protected $pipeMessage = PipeMessage::class;
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
parent::__construct($container);
|
||||
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\ConfigApollo;
|
||||
|
||||
use Hyperf\ConfigCenter\Contract\PipeMessageInterface;
|
||||
|
||||
class PipeMessage implements PipeMessageInterface
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $data;
|
||||
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function getData(): array
|
||||
{
|
||||
return $this->data ?? [];
|
||||
}
|
||||
}
|
@ -54,7 +54,7 @@ abstract class AbstractDriver implements DriverInterface
|
||||
/**
|
||||
* @var null|string
|
||||
*/
|
||||
protected $pipeMessage;
|
||||
protected $pipeMessage = PipeMessage::class;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
@ -1,24 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\ConfigEtcd;
|
||||
namespace Hyperf\ConfigCenter;
|
||||
|
||||
|
||||
use Hyperf\ConfigCenter\Contract\PipeMessageInterface;
|
||||
|
||||
class PipeMessage implements PipeMessageInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $data;
|
||||
protected $data = [];
|
||||
|
||||
public function __construct(array $data)
|
||||
{
|
||||
@ -29,4 +22,4 @@ class PipeMessage implements PipeMessageInterface
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
}
|
@ -29,8 +29,6 @@ class EtcdDriver extends AbstractDriver
|
||||
|
||||
protected $driverName = 'etcd';
|
||||
|
||||
protected $pipeMessage = PipeMessage::class;
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
parent::__construct($container);
|
||||
|
@ -12,7 +12,6 @@ declare(strict_types=1);
|
||||
namespace Hyperf\ConfigNacos;
|
||||
|
||||
use Hyperf\ConfigCenter\AbstractDriver;
|
||||
use Hyperf\ConfigNacos\PipeMessage;
|
||||
use Hyperf\Utils\Arr;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
@ -25,8 +24,6 @@ class NacosDriver extends AbstractDriver
|
||||
|
||||
protected $driverName = 'nacos';
|
||||
|
||||
protected $pipeMessage = PipeMessage::class;
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
parent::__construct($container);
|
||||
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\ConfigNacos;
|
||||
|
||||
use Hyperf\ConfigCenter\Contract\PipeMessageInterface;
|
||||
|
||||
class PipeMessage implements PipeMessageInterface
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $data;
|
||||
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function getData(): array
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\ConfigZookeeper;
|
||||
|
||||
use Hyperf\ConfigCenter\Contract\PipeMessageInterface;
|
||||
|
||||
class PipeMessage implements PipeMessageInterface
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $data;
|
||||
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function getData(): array
|
||||
{
|
||||
return $this->data ?? [];
|
||||
}
|
||||
}
|
@ -16,8 +16,6 @@ use Psr\Container\ContainerInterface;
|
||||
|
||||
class ZookeeperDriver extends AbstractDriver
|
||||
{
|
||||
protected $pipeMessage = PipeMessage::class;
|
||||
|
||||
protected $driverName = 'zookeeper';
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
|
Loading…
Reference in New Issue
Block a user