style:类型约束
This commit is contained in:
parent
6853fd6699
commit
f915a23bbd
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
return [
|
||||
'host' => env('mq_host', 'http://192.168.21.170:8085'),
|
||||
'callback_host' => env('mq_callback_host', 'http://192.168.21.170:8085'),
|
||||
'callback' => '/rocketmq/producer/notify',
|
||||
'subscribe' => [
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ class Config
|
|||
public function __construct(array $configs = [])
|
||||
{
|
||||
|
||||
foreach ($configs as $key => $val){
|
||||
if(method_exists($key, $this)){
|
||||
foreach ($configs as $key => $val) {
|
||||
if (method_exists($key, $this)) {
|
||||
call_user_func([$this, $key], $val);
|
||||
}
|
||||
}
|
||||
|
@ -28,36 +28,31 @@ class Config
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $host
|
||||
* @param string $host
|
||||
*/
|
||||
public function setHost($host): void
|
||||
public function setHost(string $host): void
|
||||
{
|
||||
$this->host = $host;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @return int
|
||||
*/
|
||||
public function getTimeOut()
|
||||
{
|
||||
return $this->timeOut;
|
||||
return $this->timeOut ?? 60;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $timeOut
|
||||
* @param int $timeOut
|
||||
*/
|
||||
public function setTimeOut($timeOut): void
|
||||
public function setTimeOut(int $timeOut): void
|
||||
{
|
||||
$this->timeOut = $timeOut;
|
||||
}
|
||||
|
||||
public function getProducerUrl(): string
|
||||
{
|
||||
return $this->getHost().'notifyUsing';
|
||||
}
|
||||
|
||||
public function getBackUrl(): string
|
||||
{
|
||||
return $this->getHost().config('rocket_mq.callback');
|
||||
return config('rocket_mq.callback_host').config('rocket_mq.callback');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user