화계 구현

This commit is contained in:
2018-11-17 01:44:54 +09:00
parent e9012adaa4
commit c8c026af16
6 changed files with 106 additions and 139 deletions
@@ -0,0 +1,32 @@
<?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;
}
}