/** * Create * * @param string|string[] $key * @param string|string[] $default * @param string $type * @param array $candidates * @return self */ public static function create($key, $default, $type, array $candidates) { $rule = new self(); $rule->key = $key; $rule->default = $default; $rule->type = $type; $rule->candidates = $candidates; $rule->delimiter = $rule->types(self::TYPE_SET) ? Straw::getConfigure('set') : null; return $rule; }
/** * Set datetime type * * @param string $format * @return $this */ public function datetime($format) { $this->piece = Straw::getConfigure('alnum'); $this->datetime_format = $format; $this->is_datetime = true; return $this; }