ReqEnvValue 추가

This commit is contained in:
2018-10-28 03:14:03 +09:00
parent f56f201bad
commit 628a085ba8
3 changed files with 114 additions and 7 deletions
+10 -3
View File
@@ -15,6 +15,7 @@ class RegGeneralValue extends Constraint{
protected $maxKey;
protected $keyNick;
protected $reqVal;
protected $comp;
public function checkInputValues(bool $throwExeception=true){
if(!parent::checkInputValues($throwExeception) && !$throwException){
@@ -24,7 +25,7 @@ class RegGeneralValue extends Constraint{
if(count($this->arg) == 4){
[$this->key, $this->keyNick, $comp, $this->reqVal] = $this->arg;
if(!in_array($comp, ['>', '>=', '==', '<=', '<', '!='])){
if(!in_array($comp, ['>', '>=', '==', '<=', '<', '!=', '===', '!=='])){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException("invalid comparator");
}
@@ -85,7 +86,13 @@ class RegGeneralValue extends Constraint{
return ($target == $src)?true:"올바르지 않은 {$keyNick} 입니다.";
},
'!='=>function($targeta, $src)use($keyNick){
return ($target == $src)?true:"올바르지 않은 {$keyNick} 입니다.";
return ($target != $src)?true:"올바르지 않은 {$keyNick} 입니다.";
},
'==='=>function($target, $src)use($keyNick){
return ($target === $src)?true:"올바르지 않은 {$keyNick} 입니다.";
},
'!=='=>function($targeta, $src)use($keyNick){
return ($target !== $src)?true:"올바르지 않은 {$keyNick} 입니다.";
},
'>='=>function($target, $src){
if($target >= $src){
@@ -97,7 +104,7 @@ class RegGeneralValue extends Constraint{
return '부족합니다.';
},
'>'=>function($target, $src){
return $target >= $src;
return $target > $src;
if($src == 0){
return '없습니다';
}