Files
core/hwe/sammo/Constraint/MustBeNPC.php
2019-04-21 16:57:05 +09:00

30 lines
725 B
PHP

<?php
namespace sammo\Constraint;
class MustBeNPC extends Constraint{
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
if(!key_exists('npc', $this->general)){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException("require npc in general");
}
return true;
}
public function test():bool{
$this->checkInputValues();
$this->tested = true;
if($this->general['npc'] < 2){
$this->reason = "NPC여야 합니다.";
return false;
}
return true;
}
}