LastTurn 관리용 객체 추가

This commit is contained in:
2018-10-03 17:27:04 +09:00
parent 040da2429f
commit 1d0bcd857e
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace sammo;
class LastTurn{
protected $command = '휴식';
protected $arg = null;
protected $term = null;
function __construct(string $json)
{
$values = Json::decode($json);
}
function setCommand(?string $command){
if($command === null){
$command = '휴식';
}
$this->command = $command;
}
function getCommand():string{
return $this->command;
}
function setArg(?array $arg){
$this->arg = $arg;
}
function getArg():?array{
return $this->arg;
}
function setTerm(?int $term){
$this->term = $term;
}
function getTerm():?int{
return $this->term;
}
function toJson():string{
$result = [
'command'=>$this->command
];
if($this->arg !== null){
$result['arg'] = $this->arg;
}
if($this->term !== null){
$result['term'] = $this->term;
}
return Json::encode($result);
}
}