Checks if the contents of the element are all alphabets
@param string $name Name of the element to filter
@param  array $options Keys may include [message]
@return boolean
18933
public function alpha(array $options) {
        if (!$options['regex'])
            $options['regex'] = ($options['acceptSpace']) ? '/[^a-zA-Z\s]/' : '/[^a-zA-Z]/';
        if (!preg_match($options['regex'], $this->elementData))
            return true;

        $this->addError($this->checkMessage('Value can only contain alphabets', $options));
        return false;
    }
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));
    }
659647
public function hasElement($name)
    {
        foreach($this->elements as $element){
            if($element->getName() == $name) {
                return true;
            }
        }

        return false;
    }
1192249
public function hasElement( $name, $prefix = null )
	{
		return isset( $this->elements[ is_null( $prefix ) ? $name : "$prefix:$name" ] );
	}
839427
private function handleOptionName($name)
    {
        if (is_string($name)) {
            $name = explode('.', $name);
        }

        foreach ($this->optionNameHandlers as $handler) {
            $name = $handler($name);
        }

        return $name;
    }
111975
public function validate($name)
	{
		$pattern = '/[\\\\\\' . implode('\\', $this->characterList) . ']/i';

		$depricatedCharacters = null;
		$fistDotMatch = null;
		$fistUnderscoreMatch = null;

		$depricatedCharacters = preg_match($pattern, $name, $depricatedCharacters);
		$fistDotMatch = preg_match('/^\./', $name, $fistDotMatch);
		$fistUnderscoreMatch = preg_match('/^\_/', $name, $fistUnderscoreMatch);

		if (( ! empty($depricatedCharacters))
				|| ( ! empty($fistDotMatch))
				|| ( ! empty($fistUnderscoreMatch))) 
		{
			return false;
		}

		return true;
	}
199183
private function mkstr($name, $type = 'string', $options = array())
    {
        $result = "  define('$name', ";
        $quot = "'";
        $value = isset($_POST[$name]) ? $_POST[$name] : null;

        if (isset($options['nobr']) && $options['nobr'])
        {
            $value = str_replace(array("\n", "\r"), ' ', $value);
        }

        if (isset($options['savebr']) && $options['savebr'])
        {
            $value = addcslashes($value, "\n\r\"");
            $quot = '"';
        }

        switch ($type)
        {
            case 'string':
                $value = str_replace(
                    array('\\', $quot),
                    array('\\\\', '\\' . $quot),
                    $value
                );
                $value = $quot . $value . $quot;
                break;
            case 'bool':
                $value = $value ? 'true' : 'false';
                break;
            case 'int':
                $value = intval($value);
                break;
        }
        $result .= $value . ");\n";
        return $result;
    }
688271
public function has($name, array $options = array())
    {
        $root = $this->builder->hasRootItemByName($name, $this->container->get('request_stack')->getCurrentRequest());

        return null !== $root;
    }
153021
private function removeHeader($name, array &$options)
    {
        foreach (array_keys($options['_headers']) as $key) {
            if (!strcasecmp($key, $name)) {
                unset($options['_headers'][$key]);
                return;
            }
        }
    }
1281358
public static function addScript(string $name, array $options = [])
    {
        if (! in_array($name, self::getScripts()))
            self::$scripts[] = $name;
        self::setOptions($name, $options);
    }
1294340
public static function fa ($name, $options = [])
		{
			if (!isset($options[ 'class' ]))
				$options[ 'class' ] = '';
			$options[ 'class' ] = trim($options[ 'class' ] . ' fa fa-' . $name);

			return self::tag('i', '', $options);
		}
546458
public static function isEnabled(array $options, string $name, $default = false): bool
    {
        $enabled = $default;
        $options = self::normalize($options);

        if (array_key_exists('*', $options)) {
            $enabled = $options['*'];
        }

        if (array_key_exists($name, $options)) {
            $enabled = (bool) $options[$name];
        }

        return $enabled;
    }
279480
public function getCheckbox($name, array $options=[]) {
		$choices = $this->getChoices();
		$default = $this->value;

		$value = isset($options['value']) ? $options['value']:null;
		if($value===null) {
			foreach($choices as $k=>$v) {
				if($v == $name) {
					$value = $k;
					break;
				}
			}
		}
		if($value === null)
			throw new \Exception('No value for checkbox '.$name);

		if(in_array($value, $default))
			$options['attrs']['checked'] = 'checked';
		$options['label'] = $name;

		return $this->getTopForm()->getWidget('checkbox', $this->name.'[]', $value, $options);
	}
241310
protected function _optionExists($name)
    {
        if (substr($name, 0, 2) === '--') {
            return isset($this->_options[substr($name, 2)]);
        }
        if ($name{0} === '-' && $name{1} !== '-') {
            return isset($this->_shortOptions[$name{1}]);
        }

        return false;
    }
602967
protected function getBlock($name, array &$options)
    {
        $block = [];

        /** @noinspection ReferenceMismatchInspection */
        if (array_key_exists($name, $options)) {
            $block = $options[$name];
            unset($options[$name]);
        }

        return $block;
    }
465662
public function isCommand($name) {
        if (!$this->docoptResult)
            return false;

        if (!($len=strlen($name)) || !isset($this->docoptResult[$name]))
            return false;
        return (bool) preg_match('/^[a-z]+$/', $name);
    }
271092
public function button($name, $options = array())
    {
        $options += array(
            "type" => "button",
            "label" => "Button",
            "id"    => $this->id($name),
            "name"  => $this->name($name),
        );

        $label = $options["label"];
        unset($options["label"]);

        return sprintf('<button %s>%s</button>', $this->arrayToHtmlAttributes($options), $label);
    }