Capitalize the given string.

@param  string  $value
@return string
19462
public function apply($value, $options = [])
    {
        $type = isset($options[0]) ? $options[0] : null;
        switch ($type) {
            case 'int':
            case 'integer':
                return (int) $value;
            case 'real':
            case 'float':
            case 'double':
                return (float) $value;
            case 'string':
                return (string) $value;
            case 'bool':
            case 'boolean':
                return (bool) $value;
            case 'object':
                return is_array($value) ? (object) $value : json_decode($value, false);
            case 'array':
                return json_decode($value, true);
            case 'collection':
                $array = is_array($value) ? $value : json_decode($value, true);
                return new Collection($array);
            default:
                throw new \InvalidArgumentException("Wrong Sanitizer casting format: {$type}.");
        }
    }
612877
public function getString($value)
    {
        $output = '[';
        for ($i = 0; $i < count($value); $i++) {
            $output .= $value[$i];
            if ($i < (count($value) - 1)) {
                $output .= ', ';
            }
        }
        $output .= ']';
        return $output;
    }
1182611
function capitalize(string) {
    return (/[a-z]/.test(string) ? string : string.toLowerCase())
        .replace(/[\s\-_]*([^\s\-_])([^\s\-_]+)/g, replacer)
        .replace(/[A-Z]/g, ' $&')
        .trim();
}
887209
public static function studlyCaps($value)
    {
        $key = $value;

        if (isset(static::$studlyCache[$key])) {
            return static::$studlyCache[$key];
        }

        static::$studlyCache[$key] = str_replace(' ', '', ucwords(str_replace(['-', '_'], ' ', $value)));

        return static::$studlyCache[$key];
    }
1193989
private function decorateStringValue(string $value) : string
    {
        if ($value === '@this'){
            return "\$c";
        }
    
        if (preg_match('/^@id:(.*)$/s',$value,$matches)){
            $id = trim($matches[1]);
            return "\$c['" . self::escapeSingleQuote($id) . "']";
        }
    
        if (preg_match('/^@resolve:(.*)$/s',$value,$matches)){
            $target = trim($matches[1]);
            return "\$c[\$c->resolve('" . self::escapeSingleQuote($target) . "')]";
        }
    
        if (preg_match('/^@func:(.*)$/s',$value,$matches)){
            $func = trim($matches[1]);
            $this->validateCallable($func);
            return $func;
        }
        
        if (preg_match('/^@int:(.*)$/s',$value,$matches)){
            $value = trim($matches[1]);
            $value = $this->validateInteger($value);
            return $this->decorateValue($value);
        }
    
        if (preg_match('/^@float:(.*)$/s',$value,$matches)){
            $value = trim($matches[1]);
            $value = $this->validateFloat($value);
            return $this->decorateValue($value);
        }
    
        if (preg_match('/^@bool:(.*)$/s',$value,$matches)){
            $value = trim($matches[1]);
            $value = $this->validateBool($value);
            return $this->decorateValue($value);
        }
    
        if (preg_match('/^@json:(.*)$/s',$value,$matches)){
            $value = trim($matches[1]);
            $value = $this->validateJson($value);
            return $this->decorateValue($value);
        }
    
        if (preg_match('/^@env:(.*)$/s',$value,$matches)){
            $id = trim($matches[1]);
            return "(\$_ENV['" . self::escapeSingleQuote($id) . "'] ?? null)";
        }
    
        return "'" . self::escapeSingleQuote($value) . "'";
    }
804906
protected function wrapValue($value)
    {
        if ($value === '*') {
            return $value;
        }

        $value = Str::upper($value);

        return '"' . str_replace('"', '""', $value) . '"';
    }
1181812
public static function sanitizeInputValue($value)
    {
        $value = self::sanitizeLineBreaks($value);
        $value = self::sanitizeString($value);
        return $value;
    }
189492
private function escape($value)
    {
        if (1 !== preg_match($this->escapeCharacterPattern, $value)) {
            return htmlspecialchars($value, ENT_QUOTES);
        }

        return str_replace(
            $this->controlCharacters, $this->escapeCharacters, htmlspecialchars($value, ENT_QUOTES)
        );
    }
771086
public function string($value)
    {
        if ($this->notBeEmpty($value)) {
            if (is_string($value) && preg_match('/[A-Za-z]+/i', $value)) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
463492
public function varReplace($value)
    {
    	if (is_string($value) && !empty($this->vars)) {
            foreach ($this->vars as $key => $val) {
	            $key = '${' . trim($key) . '}';

	            if (empty($val)) {
	                $val = '';
	            }
	            $value = str_ireplace($key, $val, $value);
	        }
        }
        return $value;
    }
1287499
private function getEscape($value = '$value')
    {
        if ($this->customEscape) {
            return sprintf(self::CUSTOM_ESCAPE, $value);
        }

        return sprintf(self::DEFAULT_ESCAPE, $value, var_export($this->entityFlags, true), var_export($this->charset, true));
    }
15862
public static function studlyCase($string) {
    $string = Strings::capitalize(Strings::replace($string, ['/-/', '/_/'], ' '));
    return Strings::replace($string, '/ /');
  }
630664
public function escape($value)
    {
        if (is_numeric($value)) {
            return $value;
        }

        return is_string($value) ? htmlspecialchars($value, ENT_QUOTES | ENT_SUBSTITUTE, $this->charset, false) : $value;
    }
917239
public function escape( $value ) {
		$value = (string)$value;

		if( $this->enableBool ) {
			if( $value == '' ) {
				return 'false';
			} elseif( $value == '1' ) {
				return 'true';
			}
		}

		if( $this->enableNumeric && is_numeric($value) ) {
			return (string)$value;
		}

		if( $this->enableAlphaNumeric && is_string($value) && ctype_alnum($value) && !is_numeric($value) ) {
			return (string)$value;
		}

		return var_export($value, true);
	}
409849
public function format($value, string $format = null)
    {
        $formatted = number_format(
            $value,
            $this->decimals,
            $format === 'nomask' ? '' : $this->decimal,
            $format === 'nomask' ? '' : $this->thousand
        );

        switch ($format) {
            case 'name':
                $name = $this->name_plural;
                if (!$name || (float) $value === 1.0) {
                    $name = $this->name;
                }
                return $formatted . ' ' . $name;
                break;

            case 'raw':
            case 'nomask':
                return $formatted;
                break;

            case 'symbol':
            default:
                return $this->symbol . ' ' . $formatted;
                break;
        }
    }
18693
protected function _setName($value)
    {
        $value = strip_tags($value);
        $value = str_replace(["\n", "\r"], '', $value);

        return trim($value);
    }
677207
private function stringify($value)
    {
        if (is_bool($value)) {
            return $value ? '<TRUE>' : '<FALSE>';
        } elseif (is_scalar($value)) {
            $val = (string) $value;

            if (strlen($val) > 100) {
                $val = substr($val, 0, 97).'...';
            }

            return $val;
        } elseif (is_array($value)) {
            return '<ARRAY>';
        } elseif (is_object($value)) {
            return sprintf('%s [%s]', get_class($value), spl_object_hash($value));
        } elseif (is_resource($value)) {
            return '<RESOURCE>';
        } elseif (is_null($value)) {
            return '<NULL>';
        } else {
            return 'unknown';
        }
    }