Files
core/hwe/sammo/Constraint/NotNeutralDestCity.php
T
2018-11-17 01:44:54 +09:00

32 lines
781 B
PHP

<?php
namespace sammo\Constraint;
class NotBeNeutral extends Constraint{
const REQ_VALUES = Constraint::REQ_DEST_CITY;
public function checkInputValues(bool $throwExeception=true){
if(!parent::checkInputValues($throwExeception) && !$throwException){
return false;
}
if(!key_exists('nation', $this->destCity)){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException("require nation in destCity");
}
return true;
}
public function test():bool{
$this->checkInputValues();
$this->tested = true;
if($this->destCity['nation'] != 0){
return true;
}
$this->reason = "공백지입니다.";
return false;
}
}