화계 구현
This commit is contained in:
@@ -112,7 +112,11 @@ class ConstraintHelper{
|
||||
return [__FUNCTION__];
|
||||
}
|
||||
|
||||
static function NotOccupiedCity():array{
|
||||
static function NotNeutralDestCity():array{
|
||||
return [__FUNCTION__];
|
||||
}
|
||||
|
||||
static function NotOccupiedDestCity():array{
|
||||
return [__FUNCTION__];
|
||||
}
|
||||
|
||||
@@ -128,7 +132,7 @@ class ConstraintHelper{
|
||||
return [__FUNCTION__];
|
||||
}
|
||||
|
||||
static function OccupiedCity(bool $allowNeutral=true):array{
|
||||
static function OccupiedCity(bool $allowNeutral=false):array{
|
||||
return [__FUNCTION__, $allowNeutral];
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user