Sets the field as required
@param string $name The name of the required field
@param string $errorPrefix The label prefix, auto calculated if omitted
339731
protected function SetRequired($name, $errorPrefix = '')
    {
        $field = $this->GetElement($name);
        if (!$field instanceof FormField)
        {
            throw new \InvalidArgumentException("$name is not a field in the form elements");
        }
        if (!$errorPrefix)
        {
            $errorPrefix = $this->ErrorPrefix($name);
        }
        $field->SetRequired($errorPrefix);
    }
1287250
public function setPrefix($prefix)
    {
        switch ($prefix) {
            case 'a': //Access
            case 'c': //Company
            case 'u': //User
            case 'g': //License Groups
            case 'admin':
            case 'status':
            case 'login-logout':
                $this->prefix = '/'.$prefix.'/';
                break;
            case null:
            case '':
            case '/':
                $this->prefix = '';
                break;
            default:
                throw new \Exception(sprintf('Unknown prefix %s', $prefix));
        }
    }
155096
private function setLink($name, $link)
    {
        if (! is_string($link) and ! is_object($link)) {
            throw new ValidationException(
                'Link attribute has to be an object or string, "' .
                gettype($link) . '" given.'
            );
        }

        if (is_string($link)) {
            $this->set($name, strval($link));

            return;
        }

        // Now $link can only be an object
        $this->set($name, $this->create('Link', $link));
    }
620524
public void setPrefix(@Nonnull String prefixName, @Nonnull String prefix) {
        if (!isUsingDefaultShortFormProvider()) {
            resetShortFormProvider();
        }
        ((DefaultPrefixManager) shortFormProvider).setPrefix(prefixName, prefix);
    }
622660
protected function assertValidName($name)
    {
        if (!is_string($name) && $name !== null) {
            $actualType = is_object($name) ? get_class($name) : gettype($name);
            $message = $this->translator()->translate(
                '{{ parameter }} must be a {{ expectedType }}, received {{ actualType }}',
                [
                    '{{ parameter }}'    => '"name"',
                    '{{ expectedType }}' => 'string',
                    '{{ actualType }}'   => $actualType,
                ]
            );

            throw new InvalidArgumentException($message, 400);
        }
    }
738195
public function setLabel( $name )
	{
		if ( $name == $this->getLabel() ) { return; }

		$this->_values['label'] = (string) $name;
		$this->_modified = true;
	}
131956
private static function validateNamingConvention($name)
    {
        $name = iconv("UTF-8", "ASCII//TRANSLIT", $name);

        // Prepend the string a to names that begin with anything but a-z This is to make a valid name
        if (preg_match('/^[A-Za-z_]/', $name) == false) {
            $name = self::NAME_PREFIX . ucfirst($name);
        }

        return preg_replace('/[^a-zA-Z0-9_x7f-xff]*/', '', preg_replace('/^[^a-zA-Z_x7f-xff]*/', '', $name));
    }
751665
public static function addRule($name, $callback, $message = 'error param')
    {
        if (!is_callable($callback)) {
            throw new \InvalidArgumentException('param $callback must can callable');
        }
        self::$errorTip[strtolower($name)] = $message;
        static::$rules[$name] = $callback;
    }
623761
public function setPrettyName($name, $prefix = true)
    {
        if (empty($name)) {
            return $this;
        }

        $this->prettyName = $this->urlize($name);
        $this->prettyPrefix = $prefix;

        return $this;
    }
480186
protected function setupFieldOptions($name, &$options)
    {
        if (!$this->getName()) {
            return;
        }

        $options['real_name'] = $name;

        if (!isset($options['label'])) {
            $options['label'] = $this->formHelper->formatLabel($name);
        }
    }
116280
public function setFieldError($field, $name)
    {
        if (!$this->app->compat_42) {
            throw $this->exception('4.3', '_Obsolete');
        }
        $this->errors[$field] = (isset($this->errors[$field]) ? $this->errors[$field] : '').$name;
    }
1149374
public void declareRequestedFieldname(String name) {
        if (name.endsWith(".*")) {
            stringSetValues.put(name, new HashMap<>());
            stringSetPrefixes.put(name.substring(0, name.length() - 1), name);
        }
    }
738627
protected function validateName($name = null)
    {
        if (null == $name) {
            $name = $this->name;
        }

        if (strlen($name) > OBJECT_NAME_LIMIT) {
            throw new Exceptions\InvalidObjectName();
        }
    }
424780
protected function setName($name)
    {
        if (false === is_string($name)) {
            $type = gettype($name);
            throw new ValidationException("Term 'name' must be of type string. Type $type received.");
        }

        $this->name = $name;
    }
681864
public function setPrefix($prefix, $field = null)
    {
        $param = $this->buildParam('facet.prefix', $field);
        return $this->set($param, $prefix);
    }
566363
static public function validateName($name)
    {
        if (null !== $name && !is_string($name)) {
            throw new Exception\UnexpectedTypeException($name, 'string, integer or null');
        }

        if (!preg_match('/^[a-zA-Z0-9_]+$/', $name)) {
            throw new Exception\InvalidArgumentException(sprintf(
                'The name "%s" contains illegal characters. Names should only contain letters, numbers and underscores.',
                $name
            ));
        }
    }
869838
public function setVendorPrefix($vendorPrefix)
    {
        if (is_string($vendorPrefix)) {
            $this->vendorPrefix = $vendorPrefix;
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($vendorPrefix). "' for argument 'vendorPrefix' given."
            );
        }
    }