ConstraintHelper 추가

This commit is contained in:
2018-11-15 03:33:44 +09:00
parent 2cb7513355
commit c3699a8595
44 changed files with 588 additions and 168 deletions
+7 -1
View File
@@ -16,7 +16,8 @@ abstract class Constraint{
const REQ_STRING_ARG = self::REQ_ARG | 0x1000;
const REQ_INT_ARG = self::REQ_ARG | 0x2000;
const REQ_NUMERIC_ARG = self::REQ_ARG | 0x4000;
const REQ_ARRAY_ARG = self::REQ_ARG | 0x8000;
const REQ_BOOLEAN_ARG = self::REQ_ARG | 0x8000;
const REQ_ARRAY_ARG = self::REQ_ARG | 0x10000;
const REQ_VALUES = 0;
@@ -144,6 +145,11 @@ abstract class Constraint{
throw new \InvalidArgumentException('require string arg');
}
if(($valueType&static::REQ_BOOLEAN_ARG) && !is_bool($this->arg)){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException('require bool arg');
}
if(($valueType&static::REQ_INT_ARG) && !is_int($this->arg)){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException('require int arg');