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