MessageTarget의 부모 클래스 Target 추가
This commit is contained in:
@@ -1,12 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace sammo;
|
namespace sammo;
|
||||||
|
|
||||||
class MessageTarget {
|
class MessageTarget extends Target {
|
||||||
/** @var int */
|
|
||||||
public $generalID;
|
|
||||||
/** @var int */
|
|
||||||
public $nationID;
|
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
public $generalName;
|
public $generalName;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
@@ -16,6 +11,7 @@ class MessageTarget {
|
|||||||
|
|
||||||
public function __construct(int $generalID, string $generalName, int $nationID, string $nationName, string $color){
|
public function __construct(int $generalID, string $generalName, int $nationID, string $nationName, string $color){
|
||||||
|
|
||||||
|
parent::__construct($generalID, $nationID);
|
||||||
|
|
||||||
if($mailbox > Message::MAILBOX_NATIONAL){
|
if($mailbox > Message::MAILBOX_NATIONAL){
|
||||||
$this->isGeneral = false;
|
$this->isGeneral = false;
|
||||||
@@ -24,9 +20,7 @@ class MessageTarget {
|
|||||||
$this->isGeneral = true;
|
$this->isGeneral = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->generalID = $generalID;
|
|
||||||
$this->generalName = $generalName;
|
$this->generalName = $generalName;
|
||||||
$this->nationID = $nationID;
|
|
||||||
$this->nationName = $nationName;
|
$this->nationName = $nationName;
|
||||||
$this->color = $color;
|
$this->color = $color;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo;
|
||||||
|
|
||||||
|
class Target {
|
||||||
|
/** @var int */
|
||||||
|
public $generalID;
|
||||||
|
/** @var int */
|
||||||
|
public $nationID;
|
||||||
|
|
||||||
|
public function __construct(int $generalID, int $nationID){
|
||||||
|
|
||||||
|
$this->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
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user