style:类型约束

This commit is contained in:
zyimm 2023-07-09 18:54:29 +08:00
parent 6853fd6699
commit f915a23bbd
2 changed files with 14 additions and 18 deletions

View File

@ -1,6 +1,7 @@
<?php <?php
return [ return [
'host' => env('mq_host', 'http://192.168.21.170:8085'), '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', 'callback' => '/rocketmq/producer/notify',
'subscribe' => [ 'subscribe' => [

View File

@ -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; $this->host = $host;
} }
/** /**
* @return mixed * @return int
*/ */
public function getTimeOut() 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; $this->timeOut = $timeOut;
} }
public function getProducerUrl(): string
{
return $this->getHost().'notifyUsing';
}
public function getBackUrl(): string public function getBackUrl(): string
{ {
return $this->getHost().config('rocket_mq.callback'); return config('rocket_mq.callback_host').config('rocket_mq.callback');
} }
} }