Refac: 메시지 타입 지정으로 MessageType Enum 사용

This commit is contained in:
2022-11-29 01:53:55 +09:00
parent 374611f66c
commit b4ac348645
22 changed files with 126 additions and 139 deletions
+6 -4
View File
@@ -1,6 +1,8 @@
<?php
namespace sammo;
use sammo\Enums\MessageType;
class DiplomaticMessage extends Message{
const ACCEPTED = 1;
@@ -18,7 +20,7 @@ class DiplomaticMessage extends Message{
protected $validDiplomacy = true;
public function __construct(
string $msgType,
MessageType $msgType,
MessageTarget $src,
MessageTarget $dest,
string $msg,
@@ -27,7 +29,7 @@ class DiplomaticMessage extends Message{
array $msgOption
)
{
if ($msgType !== self::MSGTYPE_DIPLOMACY){
if ($msgType !== MessageType::diplomacy){
throw new \InvalidArgumentException('DiplomaticMessage msgType');
}
@@ -208,7 +210,7 @@ class DiplomaticMessage extends Message{
$josaYi = JosaUtil::pick($this->src->nationName, '이');
$newMsg = new Message(
self::MSGTYPE_NATIONAL,
MessageType::national,
$this->dest,
$this->src,
"【외교】{$year}{$month}월: {$this->src->nationName}{$josaYi} {$this->dest->nationName}에게 제안한 {$this->diplomacyDetail}",
@@ -224,7 +226,7 @@ class DiplomaticMessage extends Message{
$newMsg->send();
$newMsg = new Message(
self::MSGTYPE_DIPLOMACY,
MessageType::diplomacy,
$this->dest,
$this->src,
"【외교】{$year}{$month}월: {$this->src->nationName}{$josaYi} {$this->dest->nationName}에게 제안한 {$this->diplomacyDetail}",