From e614092690fbf757d7d3ee00d153beb74a258634 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 14 Apr 2018 22:12:40 +0900 Subject: [PATCH] =?UTF-8?q?MessageTarget=EC=9D=98=20=EB=B6=80=EB=AA=A8=20?= =?UTF-8?q?=ED=81=B4=EB=9E=98=EC=8A=A4=20Target=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/MessageTarget.php | 10 ++-------- hwe/sammo/Target.php | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 hwe/sammo/Target.php diff --git a/hwe/sammo/MessageTarget.php b/hwe/sammo/MessageTarget.php index baa350be..f0072268 100644 --- a/hwe/sammo/MessageTarget.php +++ b/hwe/sammo/MessageTarget.php @@ -1,12 +1,7 @@ Message::MAILBOX_NATIONAL){ $this->isGeneral = false; @@ -24,9 +20,7 @@ class MessageTarget { $this->isGeneral = true; } - $this->generalID = $generalID; $this->generalName = $generalName; - $this->nationID = $nationID; $this->nationName = $nationName; $this->color = $color; } diff --git a/hwe/sammo/Target.php b/hwe/sammo/Target.php new file mode 100644 index 00000000..1709ada0 --- /dev/null +++ b/hwe/sammo/Target.php @@ -0,0 +1,27 @@ +generalID = $generalID; + $this->nationID = $nationID; + } + + public static function buildFromArray(array $arr) : Target + { + return new Target($arr['id'], $arr['nation_id']??0); + } + + public function toArray() : array{ + return [ + 'id'=>$this->generalID, + 'nation_id'=>$this->nationID + ]; + } +} \ No newline at end of file