Returns the first word a santized string
Strip tags, optionally strip or encode special characters.

@param string $name
@param string $verb
@param array $flags
164185
public function getWord($name, $default = '', $verb = 'get', $options = array())
    {
        //First word in a sanitized string
        $sentence = $this->getString($name, $default, false);

        //@TODO validate string before breaking into words;
        //Requires php5.3!!
        return (string)strstr($sentence, ' ', true);
    }
1284078
public static function toCamelCase($name, $symbol = '_', $capitaliseFirstChar = false)
    {
        if (is_array($name)) {
            foreach ($name as &$value) {
                $value = static::toCamelCase($value, $symbol, $capitaliseFirstChar);
            }

            return $name;
        }

        $name = lcfirst($name);
        if ($capitaliseFirstChar) {
            $name = ucfirst($name);
        }

        return preg_replace_callback('/'.$symbol.'([a-zA-Z])/', 'static::toCamelCaseConversion', $name);
    }
136396
public static function parseName($name, $type = 0, $ucfirst = true) {
        if ($type) {
            $name = preg_replace_callback('/_([a-zA-Z])/', function ($match) {
                return strtoupper($match[1]);
            }, $name);
            return $ucfirst ? ucfirst($name) : lcfirst($name);
        }

        return strtolower(trim(preg_replace("/[A-Z]/", "_\\0", $name), "_"));
    }
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;
    }
232632
protected function doesStartOrEndWithSingleQuote($name)
    {
        $startsWithSingleQuote = ($this->stringHelper->getCharFirstOccurrencePosition('\'', $name) === 0);
        $endsWithSingleQuote = ($this->stringHelper->getCharLastOccurrencePosition('\'', $name) === ($this->stringHelper->getStringLength($name) - 1));

        return ($startsWithSingleQuote || $endsWithSingleQuote);
    }
321764
public function getVar($name, $filter = '', $default = '', $verb = 'get', $options = array())
    {

        if (strtolower($verb) == 'request') {
            $verb = $this->getVerb();
        }
        //just form casting
        $verb = strtolower($verb);

        if (!($input = $this->data($verb))) {
            return $default;
        }

        //Undefined
        if (empty($name) || !isset($input) || !isset($input[$name])) {
            if (isset($default) && !empty($default)) {
                return $default;
            } else {
                return null; //nothing for that name;
            }
        }

        //Do we have a filter;
        if (!isset($filter) || !is_int($filter)) {
            //PHP warns against using gettype to get type,
            //but its much easier than running every is_* to determine type
            //so fo now we go with gettype;
            $type = gettype($input[$name]);

            switch ($type) {
                case "interger":
                    $filter = \IS\INTERGER;
                    break;
                case "float":
                case "double":
                    $filter = \IS\FLOAT;
                    $options = array(
                        "flags" => FILTER_FLAG_ALLOW_SCIENTIFIC | FILTER_FLAG_ALLOW_FRACTION | FILTER_FLAG_ALLOW_THOUSAND,
                        "options" => $options
                    );
                    break;
                case "string":
                    $filter = \IS\STRING;
                    $options = array(
                        "flags" => !FILTER_FLAG_STRIP_LOW,
                        "options" => $options
                    );
                    break;
                case "object": //@TODO,
                case "resource":
                case "NULL":
                case "unknown type":
                default:
                    $filter = \IS\RAW;
                    $options = array(
                        "flags" => !FILTER_FLAG_STRIP_LOW,
                        "options" => $options
                    );
                    break;
            }
        }
        //uhhhnrrr...
        $variable = $input[$name];

        //Pre treat;
        if (get_magic_quotes_gpc() && ($input[$name] != $default) && ($verb != 'files')) {
            $variable = stripslashes($input[$name]); //??
        }

        return $this->filter($variable, $filter, $options);
    }
591883
public function getInt($name, $default = '', $verb = 'get', $options = array())
    {

        $filter = \IS\INTERGER; //FILTER_SANITIZE_NUMBER_INT

        $interger = $this->getVar($name, $filter, $default, $verb, $options);

        //@TODO validate is interger before return
        return (int)$interger;
    }
805156
public static function get(string $name)
    {
        return (isset($_GET[$name]) && $_GET[$name] != '') ? $_GET[$name] : '';
    }
757055
private function validateTagName(string $name): void
    {
        if (! preg_match('/^' . StandardTagFactory::REGEX_TAGNAME . '$/u', $name)) {
            throw new \InvalidArgumentException(
                'The tag name "' . $name . '" is not wellformed. Tags may only consist of letters, underscores, '
                . 'hyphens and backslashes.'
            );
        }
    }
756030
private function wantSymbol(string $name, bool $isHidden = false, bool $isInline = false): Symbol
    {
        if ($isInline) {
            if (!isset($this->inline[$name]) && isset($this->symbols[$name])) {
                throw new GrammarException(
                    "Inline '$name' conflicts with token <$name> defined previously"
                );
            }
            if (isset($this->defines[$name])) {
                throw new GrammarException("Inline '$name' conflicts with DEFINE");
            }

            $this->inline[$name] = $name;
            $isHidden = true;
        } else {
            if (isset($this->inline[$name])) {
                throw new GrammarException(
                    "Token <$name> conflicts with inline '$name' defined previously"
                );
            }
            if (isset($this->defines[$name])) {
                throw new GrammarException("Token <$name> conflicts with DEFINE");
            }
        }

        return $this->symbols[$name][$isHidden]
            ?? ($this->symbols[$name][$isHidden] = new Symbol($name, true, $isHidden));
    }
593798
public function request($verb, $params = [])
    {
        $xml = $this->getOaiResponse($verb, $params);
        return $this->responseProcessor
            ? $this->responseProcessor->process($xml) : $xml;
    }
1015889
public static function rewriteToURLFriendly($name){

		// Ensure that lower case string preserves UTF-8 encoding

		$name = mb_strtolower(trim($name), "UTF-8");

		// Approximate all non-ASCII characters with their ASCII counterpart

		$name = @iconv('UTF-8', 'ASCII//TRANSLIT', $name);

		/*
		 * If text starts and ends with a brace, remove these first. Several
		 * studies have this for some reason and it screws up the page name.
		 */

		if(!empty($name)){

			if($name[0] === '(' && $name[strlen($name) - 1] === ')') {

				$name = substr($name, 1, strlen($name) - 2);
			}
		}

		// Remove text in braces

		$name = preg_replace('/\(.*?\)/', '', $name);

		// Remove all remaining invalid characters

		$name = preg_replace('/[^a-z0-9 \-]+/', '', $name);
		$name = preg_replace('/[ \-]+/', '-', trim($name));

		if(empty($name)) $name = 'blank';

		return $name;
	}
1064029
function decodeCommand( $name, $parameters )
    {
        $names = $this->ruleNames();
        $rules = array();
        switch ( $name )
        {
            // Special code handlers
            case 'url_cleanup_iri':
            case 'url_cleanup':
            case 'url_cleanup_compat':
            case 'identifier_cleanup':
            {
            } break;

            case 'normalize':
            case 'search_normalize':
            case 'decompose':
            case 'diacritical':
            case 'lowercase':
            case 'uppercase':
            case 'search_cleanup':
            {
                if ( count( $parameters ) == 0 )
                {
                    // Include all normalize rules
                    foreach ( $names as $rule )
                    {
                        if ( preg_match( '#_'. $name . '$#', $rule ) )
                            $rules[] = $rule;
                    }
                }
                else
                {
                    foreach ( $parameters as $parameter )
                    {
                        $rule = $parameter . '_' . $name;
                        if ( in_array( $rule, $names ) )
                            $rules[] = $rule;
                    }
                }
            } break;

            case 'transform':
            case 'transliterate':
            {
                $dividers = array( 'transform' => '_to_',
                                   'transliterate' => '_transliterate_' );
                $divider = $dividers[$name];
                if ( count( $parameters ) == 0 )
                {
                    // Include all transformation rules
                    foreach ( $names as $rule )
                    {
                        if ( preg_match( '#^[a-zA-Z][a-zA-Z0-9-]+'. $divider . '[a-zA-Z][a-zA-Z0-9-]+$#', $rule ) )
                            $rules[] = $rule;
                    }
                }
                else if ( count( $parameters ) == 2 )
                {
                    $rule = $parameters[0] . $divider . $parameters[1];
                    if ( in_array( $rule, $names ) )
                        $rules[] = $rule;
                }
            } break;

            default:
            {
                $ini = eZINI::instance( 'transform.ini' );
                $commands = $ini->variable( 'Extensions', 'Commands' );
                if ( isset( $commands[$name] ) )
                {
                    break;
                }
                eZDebug::writeError( "Unknown command '$name'", __METHOD__ );
            } break;
        }
        return $rules;
    }
57806
public function delete($name)
    {
        $nameString = TypeHinter::to('USVString', $name);
        array_splice($this->list, 0, count($this->list), array_filter($this->list, function ($pair) use ($nameString) {
            return $pair[0] !== $nameString;
        }));
        $this->update();
    }
1265805
public function request($verb, array $params = array())
    {
        if (! $this->url) {
            throw new RuntimeException("Cannot perform request when URL not set.  Use setUrl() method");
        }

        //Build the URL
        $params = array_merge(array('verb' => $verb), $params);
        $url = $this->url . (parse_url($this->url, PHP_URL_QUERY) ? '&' : '?') . http_build_query($params);

        //Do the request
        try {
            $resp = $this->httpAdapter->request($url);
            return $this->decodeResponse($resp);
        } catch (HttpException $e) {
            $this->checkForOaipmhException($e);
        }
    }
136316
public function word($data, $default = '', $options = [])
    {

        //First word in a sanitized string
        $sentence = $this->string($data, $default, $options, false);

        //@TODO validate string before breaking into words;
        //Requires php5.3!!
        return (string)strstr($sentence, ' ', true);
    }
1269054
def GetFlag(self, name):
    """"""
    res = self.FlagDict().get(name)
    if res is None:
      raise exceptions.UnrecognizedFlagError(name)
    return res