버그 수정...

This commit is contained in:
2019-10-06 14:49:41 +09:00
parent 70181d95c7
commit 934c1b0cfe
28 changed files with 115 additions and 102 deletions
+9 -2
View File
@@ -26,6 +26,8 @@ abstract class Constraint{
protected $nation = null;
protected $arg = null;
protected $env = null;
protected $cmd_arg = null;
protected $destGeneral = null;
@@ -62,6 +64,11 @@ abstract class Constraint{
$this->tested = false;
$this->reason = null;
}
public function setEnv($env){
$this->env = $env;
$this->tested = false;
$this->reason = null;
}
public function setCmdArg($cmd_arg){
$this->cmd_arg = $cmd_arg;
$this->tested = false;
@@ -182,7 +189,7 @@ abstract class Constraint{
return $this->reason;
}
public static function testAll(array $constraintPacks, array $input):?string{
public static function testAll(array $constraintPacks, array $input, array $env):?string{
foreach($constraintPacks as $constraintArgs){
if (!$constraintArgs){
continue;
@@ -194,7 +201,7 @@ abstract class Constraint{
$constraint = call_user_func($method,$input);
assert($constraint instanceof Constraint);
$constraint->setEnv($env);
if(count($constraintArgs) == 2){
$arg = $constraintArgs[1];
$constraint->setArg($arg);
+2 -2
View File
@@ -23,11 +23,11 @@ class ReqEnvValue extends Constraint{
}
if(count($this->arg) == 4){
[$this->key, $this->reqVal, $comp, $this->msg] = $this->arg;
[$this->key, $comp, $this->reqVal, $this->msg] = $this->arg;
if(!in_array($comp, ['>', '>=', '==', '<=', '<', '!=', '===', '!=='])){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException("invalid comparator");
throw new \InvalidArgumentException("invalid comparator($comp)");
}
}
else{