수몰 구현, createGeneralObjFromDB 최적화

This commit is contained in:
2020-03-21 17:36:36 +09:00
parent 48d5c2c772
commit 3c0bb7ca41
11 changed files with 281 additions and 35 deletions
@@ -0,0 +1,32 @@
<?php
namespace sammo\Constraint;
class AvailableStrategicCommand extends Constraint{
const REQ_VALUES = Constraint::REQ_NATION;
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
if(!key_exists('strategic_cmd_limit', $this->nation)){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException("require strategic_cmd_limit in nation");
}
return true;
}
public function test():bool{
$this->checkInputValues();
$this->tested = true;
if($this->nation['strategic_cmd_limit'] == 0){
return true;
}
$this->reason = "전략기한이 남았습니다.";
return false;
}
}