Ejemplo n.º 1
0
Archivo: Sets.php Proyecto: nnssn/straw
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * 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;
 }