示例#1
0
 private final function handleSet($root_field_name, $arg1, $arg2)
 {
     if (TRUE === Kit::isVacancy($arg2)) {
         return $this->setDocument($root_field_name, NULL, $arg1);
     } else {
         Kit::ensureString($arg1);
         return $this->setDocument($root_field_name, $arg1, $arg2);
     }
 }
示例#2
0
 public static final function isAllSame(&$array, $value = self::TYPE_VACANCY)
 {
     self::ensureArray($array);
     $value_list = array_values($array);
     if (0 === count($value_list)) {
         return TRUE;
     }
     if (FALSE === Kit::isVacancy($value) and $value_list[0] !== $value) {
         return FALSE;
     }
     if (self::count($value_list[0], $value_list) !== self::len($value_list)) {
         return FALSE;
     }
     return TRUE;
 }
示例#3
0
 private final function handleResult($type, $name, $value, $is_list)
 {
     Kit::ensureString($name, TRUE);
     if (TRUE === Kit::isString($name)) {
         if (TRUE === Kit::isVacancy($value)) {
             // (valid)
             return $this->getResult($type, $name);
         }
         // (valid, valid/NULL)
         return $this->setResult($type, $name, $value, $is_list);
     } elseif (TRUE === is_null($name)) {
         if (TRUE === Kit::isVacancy($value)) {
             // (NULL) / ()
             return $this->getResult($type, NULL);
         }
         // (NULL, valid/NULL)
         throw new UserException('Invalid $value when $name is NULL.', $value);
     } else {
         // (invalid, valid/NULL/empty)
         throw new UserException('Invalid $name.', $name);
     }
 }