public function oneOf($allowed, $message = null)
    {
        if (is_string($allowed)) {
            $allowed = explode(',', $allowed);
        }

        $this->setRule(__FUNCTION__, function($val, $args)
                       {
                           return in_array($val, $args[0]);
                       }, $message, array($allowed));
        return $this;
    }
public function oneOf($allowed, $message = null)
    {
        if (is_string($allowed)) {
            $allowed = explode(',', $allowed);
        }

        $this->setRule(__FUNCTION__, function($val, $args)
                       {
                           return in_array($val, $args[0]);
                       }, $message, array($allowed));
        return $this;
    }
public function oneOf ( $ allowed , $ message = null ) { if ( is_string ( $ allowed ) ) { $ allowed = explode ( ',' , $ allowed ) ; } $ this -> setRule ( __FUNCTION__ , function ( $ val , $ args ) { return in_array ( $ val , $ args [ 0 ] ) ; } , $ message , array ( $ allowed ) ) ; return $ this ; }
Field has to be one of the allowed ones.

@param string|array $allowed Allowed values.
@param string $message
@return FormValidator
Field has to be one of the allowed ones .