Sets the prefix (namespace) for the internal keys.

@param string $str The string to use as internal key prefix.

@throws StrictTypeException
@throws InvalidArgumentException

@psalm-suppress RedundantConditionGivenDocblockType

@return void
516665
protected function setWebAppPrefix($str): void
    {
        $type = gettype($str);
        if (! is_string($str)) {
            throw StrictTypeException::cstrTypeError($str, 'WebApp Prefix');
        }
        $str = strtoupper(trim($str));
        if (strlen($str) < 3) {
            throw InvalidArgumentException::webappPrefixTooShort($str);
        }
        if (strlen($str) > 32) {
            throw InvalidArgumentException::webappPrefixTooLong($str);
        }
        if (preg_match('/[^A-Z0-9]/', $str) !== 0) {
            throw InvalidArgumentException::webappPrefixNotAlphaNumeric($str);
        }
        $this->webappPrefix = $str . '_';
    }
935029
public function prefix(string $prefix) : void
    {
        parent::prefix($prefix);
        $this->element->prefix($prefix);
    }
1189096
protected function setNamespace($xml) {
        if ($this->configured) throw new IllegalStateException('Configuration is frozen');

        $namespace = '';                    // default is the global namespace

        if (isset($xml['namespace'])) {
            $namespace = trim((string) $xml['namespace']);
            $namespace = str_replace('/', '\\', $namespace);

            if ($namespace == '\\') {
                $namespace = '';
            }
            else if (strlen($namespace)) {
                if (!$this->isValidNamespace($namespace)) throw new StrutsConfigException('<struts-config namespace="'.$xml['namespace'].'": Invalid module namespace');
                if (strStartsWith($namespace, '\\')) $namespace  = substr($namespace, 1);
                if (!strEndsWith($namespace, '\\'))  $namespace .= '\\';
            }
        }
        $this->imports[strtolower($namespace)] = $namespace;
    }
85017
private function typeCast(&$str)
  {
    if (is_numeric($str)) {
      $cast = intval($str);
      if ($str == (string) $cast) {
        $str = $cast;
      } else {
        $str = floatval($str);
      }
    }
  }
662632
private function toNamespace($str) {
        $stringParts = preg_split('/_+/', $str);

        foreach($stringParts as $key => $stringPart){
            $stringParts[$key] = ucfirst(strtolower($stringPart));
        }
        return implode('\\', $stringParts) . '\\';
    }
438617
function set(prefix, value) {
    for (const key of keys(value)) {
      const name = prefix ? `${prefix}[${key}]` : key
      const field = value[key]

      if (isArray(field) || isPlainObject(field)) {
        set(name, field)
      } else {
        if (options.strict && (isBoolean(field) && field === false)) {
          continue
        }

        fd[method](name, field)
      }
    }
  }
840165
public function setCachePrefix($prefix) {
		if (empty($prefix)) {
			$this->prefix = null;
			return;
		}
		
		$prefix = strtolower($prefix);
		
		if (preg_match('/[^0-9a-z_]+/', $prefix)) {
			throw new NoPath('Forbidden symbols used in the prefix');
		}
		
		$this->prefix = $prefix;
	}
843650
public static function toKey($str)
  {
    // Remove spaces and dashes, then convert to lower case.
    $str = self::toUnderscoreSeparated($str);
    $str = mb_strtolower($str);

    return $str;
  }
625878
public function startsWith($str)
    {
        self::mustBeString($str, 'Searched starting string');

        $str = preg_quote($str, '/');

        return (boolean) preg_match("/^$str/", $this->value);
    }
674940
private function getEncryptionKey($str = null)
    {
        $key        = $this->getSalt();
        $key_crypt  = md5($key);
        $count      = 0;
        $tmp        = '';
        for ($ctr=0;$ctr<strlen($str);$ctr++) {
            if ($count==strlen($key_crypt)) {
                $count=0;
            }
            $tmp.= substr($str,$ctr,1) ^ substr($key_crypt,$count,1);
            $count++;
        }
        return $tmp;
    }
888279
protected function parseTemplate($str)
    {
        $tag = '/{([\/$]?[-_:\w]*)}/';

        $input = preg_split($tag, $str, -1, PREG_SPLIT_DELIM_CAPTURE);

        $prefix = current($input);
        next($input);
        $this->template = [$prefix];

        $this->parseTemplateRecursive($input, $this->template);
    }
105303
public function endsWith(self $str, MStringComparison $cmp = null){
		
		if($str->isNullOrEmpty()){
			throw new \InvalidArgumentException('$str is empty');
		}
		
		if($str->count() > $this->count()){
			throw new \InvalidArgumentException('$str is longer than $this');
		}
		
		if($cmp === null || $cmp->Value === MStringComparison::CASE_SENSITIVE){
			return $this
					->substring($this->count() - $str->count(), $str->count())
					->_Value === $str->_Value;
		}
		else{
			return $this
					->substring($this->count() - $str->count(), $str->count())
					->toLower()->_Value === $str->toLower()->_Value;
		}
		
	}
1366330
public function writeAll($str)
    {
        if (substr($str, -1) == "\n") {
            $str = substr($str, 0, -1);
        }
        $this->write($str);
        $this->close('in');
        $this->debugStatus();

        return $this;
    }
1174678
private function setPrefix($prefix)
    {
        if (0 === strlen($prefix)) {
            throw new \InvalidArgumentException('Group prefix may not be empty.');
        }

        $prefix = '/'.trim($prefix, '/');

        $this->prefix = $this->hasParent() ? $this->parent->getPrefix() . $prefix : $prefix;
    }
1310170
public static function fromName($str){
		
		$strName = \strtoupper(\trim($str));
		
		foreach(static::getConstants() as $name => $value){
			if($strName === \strtoupper($name)){
				return new static($value);
			}
		}
		
		return null;
		
	}
381945
public function _setTokenEnd($delimiter)
    {
        if (
            !($delimiter instanceof Stringable) &&
            !is_string($delimiter) &&
            !is_null($delimiter)
        ) {
            throw $this->_createInvalidArgumentException($this->__('Invalid token start delimiter'), null, null, $delimiter);
        }

        $this->tokenEnd = $delimiter;
    }
1002046
public function writeString($str) {

            $strref = strlen($str) << 1 | 0x01;
            $this->writeInt($strref);
            $this->stream->writeBuffer($str);

        }