/*!
Static
Returns alphabet.
971855
static function fetchAlphabet()
    {
        $contentINI = eZINI::instance( 'content.ini' );

        $alphabetRangeList = $contentINI->hasVariable( 'AlphabeticalFilterSettings', 'AlphabetList' )
                             ? $contentINI->variable( 'AlphabeticalFilterSettings', 'AlphabetList' )
                             : array();

        $alphabetFromArray = $contentINI->hasVariable( 'AlphabeticalFilterSettings', 'ContentFilterList' )
                             ? $contentINI->variable( 'AlphabeticalFilterSettings', 'ContentFilterList' )
                             : array( 'default' );

        // If alphabet list is empty
        if ( count( $alphabetFromArray ) == 0 )
            return false;

        $alphabetRangeList = array_merge( $alphabetRangeList, array( 'default' => '97-122' ) );
        $alphabet = array();
        foreach ( $alphabetFromArray as $alphabetFrom )
        {
            // If $alphabetFrom exists in range array $alphabetRangeList
            if ( isset( $alphabetRangeList[$alphabetFrom] ) )
            {
                $lettersArray = explode( ',', $alphabetRangeList[$alphabetFrom] );
                foreach ( $lettersArray as $letter )
                {
                    $rangeArray =  explode( '-', $letter );
                    if ( isset( $rangeArray[1] ) )
                    {
                        $alphabet = array_merge( $alphabet, range( trim( $rangeArray[0] ), trim( $rangeArray[1] ) ) );
                    }
                    else
                        $alphabet = array_merge( $alphabet, array( trim( $letter ) ) );
                }
            }
        }
        // Get alphabet by default (eng-GB)
        if ( count( $alphabet ) == 0 )
        {
            $rangeArray = explode( '-', $alphabetRangeList['default'] );
            $alphabet = range( $rangeArray[0], $rangeArray[1] );
        }
        $resAlphabet = array();
        $i18nINI = eZINI::instance( 'i18n.ini' );
        $charset = $i18nINI->variable( 'CharacterSettings', 'Charset' );

        $codec = eZTextCodec::instance( 'utf-8', $charset );

        $utf8_codec = eZUTF8Codec::instance();
        // Convert all letters of alphabet from unicode to utf-8 and from utf-8 to current locale
        foreach ( $alphabet as $item )
        {
            $utf8Letter = $utf8_codec->toUtf8( $item );
            $resAlphabet[] = $codec ? $codec->convertString( $utf8Letter ) : $utf8Letter;
        }

        return $resAlphabet;
    }
849823
static function character($length = 6, $alphabet = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789')
    {
        /*
         * mt_srand() is to fix:
            mt_rand(0,100);
            if(pcntl_fork()){
                var_dump(mt_rand(0,100));
            }else{
                var_dump(mt_rand(0,100));
            }
         */
        mt_srand();
        // 重复字母表以防止生成长度溢出字母表长度
        if ($length >= strlen($alphabet)) {
            $rate = intval($length / strlen($alphabet)) + 1;
            $alphabet = str_repeat($alphabet, $rate);
        }

        // 打乱顺序返回
        return substr(str_shuffle($alphabet), 0, $length);
    }
1126692
static function CamelCase($string) {
		$string = preg_replace_callback('#([_])(\w)#', function ($m) {
			return strtoupper($m[2]);
		}, strtolower($string));

		return ucfirst($string);
	}
217155
private static function jsMatcher($matches) {

        $chr = $matches[0];

        if(1 === strlen($chr)) {
            return sprintf('\\x%02X', ord($chr));
        }

        $chr = static :: convert($chr, 'UTF-8', 'UTF-16BE');
        $hex = strtoupper(bin2hex($chr));

        if(strlen($hex) <= 4) {
            return sprintf('\\u%04s', $hex);
        }

        return sprintf('\\u%04s\\u%04s', substr($hex, 0, 4), substr($hex, 4, 4));
    }
885767
public static function __static()
    {
        self::addRecognition(function($string) { if (self::toBool($string)) { return true; } }, 'booleanTrue');
        self::addRecognition(function($string) { if (in_array(strtolower($string), ['no', 'false', 'off'])) { return false; } }, 'booleanFalse');
        self::addRecognition(function($string) { if (preg_match('/^[+-]?[0-9]+$/', $string) != false) { return self::toInt($string);} }, 'int');
        self::addRecognition(function($string) { if (preg_match('/^[+-]?[0-9]+\.[0-9]+$/', $string) != false) { return self::toFloat($string); } }, 'float');
        self::addRecognition(
                function($string)
                {
                    if (substr($string, 0, 1) === '[' && substr($string, -1) === ']') {
                        return (strstr($string, ':') !== false) ? self::toMap($string) : self::toList($string);
                    }
                },
                'array'
        );
        self::addRecognition(function($string) { if (strstr($string, '..') !== false) { return self::toRange($string); } }, 'range');
        self::addRecognition(function($string) { $classname = self::toClassname($string); if (null !== $classname) { return $classname; } }, 'string');
        self::addRecognition(function($string) { $class = self::toClass($string); if (null !== $class) { return $class; } }, 'ReflectionClass');
        self::addRecognition(function($string) { if (defined($string)) { return constant($string); } }, 'constant');
    }
637130
function getSlug(input, opts) {
        var separator = '-';
        var result = '';
        var diatricString = '';
        var convertSymbols = true;
        var customReplacements = {};
        var maintainCase;
        var titleCase;
        var truncate;
        var uricFlag;
        var uricNoSlashFlag;
        var markFlag;
        var symbol;
        var langChar;
        var lucky;
        var i;
        var ch;
        var l;
        var lastCharWasSymbol;
        var lastCharWasDiatric;
        var allowedChars = '';

        if (typeof input !== 'string') {
            return '';
        }

        if (typeof opts === 'string') {
            separator = opts;
        }

        symbol = symbolMap.en;
        langChar = langCharMap.en;

        if (typeof opts === 'object') {
            maintainCase = opts.maintainCase || false;
            customReplacements = (opts.custom && typeof opts.custom === 'object') ? opts.custom : customReplacements;
            truncate = (+opts.truncate > 1 && opts.truncate) || false;
            uricFlag = opts.uric || false;
            uricNoSlashFlag = opts.uricNoSlash || false;
            markFlag = opts.mark || false;
            convertSymbols = (opts.symbols === false || opts.lang === false) ? false : true;
            separator = opts.separator || separator;

            if (uricFlag) {
                allowedChars += uricChars;
            }

            if (uricNoSlashFlag) {
                allowedChars += uricNoSlashChars;
            }

            if (markFlag) {
                allowedChars += markChars;
            }

            symbol = (opts.lang && symbolMap[opts.lang] && convertSymbols) ?
                symbolMap[opts.lang] : (convertSymbols ? symbolMap.en : {});

            langChar = (opts.lang && langCharMap[opts.lang]) ?
                langCharMap[opts.lang] :
                opts.lang === false || opts.lang === true ? {} : langCharMap.en;

            // if titleCase config is an Array, rewrite to object format
            if (opts.titleCase && typeof opts.titleCase.length === 'number' && Array.prototype.toString.call(opts.titleCase)) {
                opts.titleCase.forEach(function (v) {
                    customReplacements[v + ''] = v + '';
                });

                titleCase = true;
            } else {
                titleCase = !!opts.titleCase;
            }

            // if custom config is an Array, rewrite to object format
            if (opts.custom && typeof opts.custom.length === 'number' && Array.prototype.toString.call(opts.custom)) {
                opts.custom.forEach(function (v) {
                    customReplacements[v + ''] = v + '';
                });
            }

            // custom replacements
            Object.keys(customReplacements).forEach(function (v) {
                var r;

                if (v.length > 1) {
                    r = new RegExp('\\b' + escapeChars(v) + '\\b', 'gi');
                } else {
                    r = new RegExp(escapeChars(v), 'gi');
                }

                input = input.replace(r, customReplacements[v]);
            });

            // add all custom replacement to allowed charlist
            for (ch in customReplacements) {
                allowedChars += ch;
            }
        }

        allowedChars += separator;

        // escape all necessary chars
        allowedChars = escapeChars(allowedChars);

        // trim whitespaces
        input = input.replace(/(^\s+|\s+$)/g, '');

        lastCharWasSymbol = false;
        lastCharWasDiatric = false;

        for (i = 0, l = input.length; i < l; i++) {
            ch = input[i];

            if (isReplacedCustomChar(ch, customReplacements)) {
                // don't convert a already converted char
                lastCharWasSymbol = false;
            } else if (langChar[ch]) {
                // process language specific diactrics chars conversion
                ch = lastCharWasSymbol && langChar[ch].match(/[A-Za-z0-9]/) ? ' ' + langChar[ch] : langChar[ch];

                lastCharWasSymbol = false;
            } else if (ch in charMap) {
                // the transliteration changes entirely when some special characters are added
                if (i + 1 < l && lookAheadCharArray.indexOf(input[i + 1]) >= 0) {
                    diatricString += ch;
                    ch = '';
                } else if (lastCharWasDiatric === true) {
                    ch = diatricMap[diatricString] + charMap[ch];
                    diatricString = '';
                } else {
                    // process diactrics chars
                    ch = lastCharWasSymbol && charMap[ch].match(/[A-Za-z0-9]/) ? ' ' + charMap[ch] : charMap[ch];
                }

                lastCharWasSymbol = false;
                lastCharWasDiatric = false;
            } else if (ch in diatricMap) {
                diatricString += ch;
                ch = '';
                // end of string, put the whole meaningful word
                if (i === l - 1) {
                    ch = diatricMap[diatricString];
                }
                lastCharWasDiatric = true;
            } else if (
                // process symbol chars
                symbol[ch] && !(uricFlag && uricChars
                    .indexOf(ch) !== -1) && !(uricNoSlashFlag && uricNoSlashChars
                    // .indexOf(ch) !== -1) && !(markFlag && markChars
                    .indexOf(ch) !== -1)) {
                ch = lastCharWasSymbol || result.substr(-1).match(/[A-Za-z0-9]/) ? separator + symbol[ch] : symbol[ch];
                ch += input[i + 1] !== void 0 && input[i + 1].match(/[A-Za-z0-9]/) ? separator : '';

                lastCharWasSymbol = true;
            } else {
                if (lastCharWasDiatric === true) {
                    ch = diatricMap[diatricString] + ch;
                    diatricString = '';
                    lastCharWasDiatric = false;
                } else if (lastCharWasSymbol && (/[A-Za-z0-9]/.test(ch) || result.substr(-1).match(/A-Za-z0-9]/))) {
                    // process latin chars
                    ch = ' ' + ch;
                }
                lastCharWasSymbol = false;
            }

            // add allowed chars
            result += ch.replace(new RegExp('[^\\w\\s' + allowedChars + '_-]', 'g'), separator);
        }

        if (titleCase) {
            result = result.replace(/(\w)(\S*)/g, function (_, i, r) {
                var j = i.toUpperCase() + (r !== null ? r : '');
                return (Object.keys(customReplacements).indexOf(j.toLowerCase()) < 0) ? j : j.toLowerCase();
            });
        }

        // eliminate duplicate separators
        // add separator
        // trim separators from start and end
        result = result.replace(/\s+/g, separator)
            .replace(new RegExp('\\' + separator + '+', 'g'), separator)
            .replace(new RegExp('(^\\' + separator + '+|\\' + separator + '+$)', 'g'), '');

        if (truncate && result.length > truncate) {
            lucky = result.charAt(truncate) === separator;
            result = result.slice(0, truncate);

            if (!lucky) {
                result = result.slice(0, result.lastIndexOf(separator));
            }
        }

        if (!maintainCase && !titleCase) {
            result = result.toLowerCase();
        }

        return result;
    }
1036233
protected function selfMin()
    {
        if (!$this->css) {
            return $this->css;
        }
        $static = &static::$static[__FUNCTION__.'_map'];

        if (!isset($static['replace'], $static['with'], $static['colors'])) {
            $de_spacifiables = array(
                '{',
                '}',
                '!=',
                '|=',
                '^=',
                '$=',
                '*=',
                '~=',
                '=',
                '~',
                ';',
                ',',
                '>',
            );
            $de_spacifiables = array_map(
                function ($string) {
                    return preg_quote($string, '/');
                },
                $de_spacifiables
            );
            $de_spacifiables = implode('|', $de_spacifiables);

            $static['replace'] = array(
                'comments'        => '/\/\*.*?\*\//s',
                'line_breaks'     => '/['."\r\n".']+/',
                'extra_spaces'    => '/\s{2,}/',
                'de_spacifiables' => '/ *('.$de_spacifiables.') */',
                'unnecessary_;s'  => '/;\}/',
            );
            $static['with']   = array('', ' ', ' ', '${1}', '}');
            $static['colors'] = '/(?P<context>[:,\h]+#)(?P<hex>[a-z0-9]{6})/i';
        }
        $this->css = preg_replace($static['replace'], $static['with'], $this->css);
        $this->css = preg_replace_callback($static['colors'], array($this, 'selfMaybeCompressCssColorCb'), $this->css);
        $this->css = trim($this->css);

        return $this->css;
    }
407531
public static function __static()
	{
		InstanceFactsIterator::$itemSubstitutionGroup = array( \XBRL_Constants::$xbrliItem );
		InstanceFactsIterator::$tupleSubstitutionGroup = array( \XBRL_Constants::$xbrliTuple );
		InstanceFactsIterator::$nodeTest = XmlQualifiedNameTest::create( "substitutionGroup" );
	}
221017
public static function __static()
	{
		SchemaTypes::$nameStartChar = "[:_\.\p{Ll}\p{Lu}\p{Lt}\p{Lo}]";
		SchemaTypes::$nameChar = "[:_\-.\p{L}\p{Ll}\p{M}\p{Nd}\p{Nl}]";
		SchemaTypes::$name = SchemaTypes::$nameStartChar .  SchemaTypes::$nameChar . "*";
		SchemaTypes::$ncName = "(?:(?!:)" . SchemaTypes::$nameStartChar. ")(?:(?!:)" . SchemaTypes::$nameChar . ")*";

		// SchemaTypes are organized hierarchically
		// BMS 2018-04-09 Fixing the kluge
		SchemaTypes::$xsTypes = array(
			'xs:anyType'				=> null,
			'xs:anySimpleType'			=> 'xs:anyType',
			'xs:string'					=> 'xs:anySimpleType',
			'xs:boolean'				=> 'xs:anySimpleType',
			'xs:decimal'				=> 'xs:anySimpleType',
			'xs:double'					=> 'xs:anySimpleType',
			'xs:float'					=> 'xs:anySimpleType',
			'xs:duration'				=> 'xs:anySimpleType',
			'xs:dateTime'				=> 'xs:anySimpleType',
			'xs:time'					=> 'xs:anySimpleType',
			'xs:date'					=> 'xs:anySimpleType',
			'xs:gYearMonth'				=> 'xs:anySimpleType',
			'xs:gYear'					=> 'xs:anySimpleType',
			'xs:gMonthDay'				=> 'xs:anySimpleType',
			'xs:gDay'					=> 'xs:anySimpleType',
			'xs:gMonth'					=> 'xs:anySimpleType',
			'xs:hexBinary'				=> 'xs:anySimpleType',
			'xs:base64Binary'			=> 'xs:anySimpleType',
			'xs:anyURI'					=> 'xs:anySimpleType',
			'xs:QName'					=> 'xs:anySimpleType',
			'xs:NOTATION'				=> 'xs:anySimpleType',
			'xs:NOTATION'				=> 'xs:anySimpleType',
			'xs:normalizedString'		=> 'xs:string',
			'xs:token'					=> 'xs:normalizedString',
			'xs:Name'					=> 'xs:token',
			'xs:NCName'					=> 'xs:Name',
			'xs:NMTOKEN'				=> 'xs:token',
			'xs:NMTOKENS'				=> 'xs:NMTOKEN',
			'xs:language'				=> 'xs:token',
			'xs:ID'						=> 'xs:NCName',
			'xs:IDREF'					=> 'xs:NCName',
			'xs:ENTITY'					=> 'xs:NCName',
			'xs:IDREFS'					=> 'xs:IDREF',
			'xs:ENTITIES'				=> 'xs:ENTITY',
			'xs:integer'				=> 'xs:decimal',
			'xs:nonPositiveInteger'		=> 'xs:integer',
			'xs:long'					=> 'xs:integer',
			'xs:nonNegativeInteger'		=> 'xs:integer',
			'xs:negativeInteger' 		=> 'xs:nonPositiveInteger',
			'xs:int'					=> 'xs:long',
			'xs:short'					=> 'xs:int',
			'xs:byte'					=> 'xs:short',
			'xs:positiveInteger' 		=> 'xs:nonNegativeInteger',
			'xs:unsignedLong' 			=> 'xs:nonNegativeInteger',
			'xs:unsignedInt' 			=> 'xs:unsignedLong',
			'xs:unsignedShort'			=> 'xs:unsignedInt',
			'xs:unsignedByte'			=> 'xs:unsignedShort',
			'xs:anyComplexType'			=> 'xs:anyType',
			'xs:untypedAtomic'			=> 'xs:anySimpleType',
			// Not really a type but trying to find an easy way to accommodate
			// unions of simple types such as xbrli:dateTimeItemType
			'xs:UNION'					=> 'xs:anySimpleType',
			'xs:yearMonthDuration'		=> 'xs:duration',
			'xs:dayTimeDuration'		=> 'xs:duration',
		);
	}
1071992
static function &charsetList()
    {
        $charsets =& $GLOBALS["eZMBCharsetList"];
        if ( !is_array( $charsets ) )
        {
            $charsetList = array( "ucs-4", "ucs-4be", "ucs-4le", "ucs-2", "ucs-2be", "ucs-2le", "utf-32", "utf-32be", "utf-32le", "utf-16",
                                  "utf-16be", "utf-16le", "utf-8", "utf-7", "ascii", "euc-jp", "sjis", "eucjp-win", "sjis-win", "iso-2022-jp", "jis",
                                  "iso-8859-1", "iso-8859-2", "iso-8859-3", "iso-8859-4", "iso-8859-5", "iso-8859-6", "iso-8859-7", "iso-8859-8",
                                  "iso-8859-9", "iso-8859-10", "iso-8859-13", "iso-8859-14", "iso-8859-15", "byte2be", "byte2le", "byte4be",
                                  "byte4le", "base64", "7bit", "8bit", "utf7-imap" );
            $charsets = array();
            foreach ( $charsetList as $charset )
            {
                $charsets[$charset] = $charset;
            }
        }
        return $charsets;
    }
417542
private static function _getCharMap(): array
    {
        // Keep local copy
        static $map = [];

        if (empty($map)) {
            // This will replace accented chars with non-accented chars
            foreach (StringHelper::asciiCharMap() as $asciiChar => $charsArray) {
                foreach ($charsArray as $char) {
                    $map[$char] = $asciiChar;
                }
            }

            // Replace punctuation with a space
            foreach (self::_getPunctuation() as $value) {
                $map[$value] = ' ';
            }
        }

        // Return the char map
        return $map;
    }
806305
static function __static()
	{

		DOMXPathNavigator::$nodeTypeMap = array(
			XML_ELEMENT_NODE => XPathNodeType::Element,
			XML_ATTRIBUTE_NODE => XPathNodeType::Attribute,
			XML_TEXT_NODE => XPathNodeType::Text,
			// XML_CDATA_SECTION_NODE => 4,
			// XML_ENTITY_REF_NODE => 5,
			// XML_ENTITY_NODE => 6,
			XML_PI_NODE => XPathNodeType::ProcessingInstruction,
			XML_COMMENT_NODE => XPathNodeType::Comment,
			XML_DOCUMENT_NODE => XPathNodeType::Root,
			// XML_DOCUMENT_TYPE_NODE => XPathNodeType::Element, // .NET does not consider this an element
			// XML_DOCUMENT_FRAG_NODE => 11,
			XML_NOTATION_NODE => 12,
			// XML_HTML_DOCUMENT_NODE => 13,
			// XML_DTD_NODE => 14,
			XML_ELEMENT_DECL_NODE => XPathNodeType::Element,
			XML_ATTRIBUTE_DECL_NODE => XPathNodeType::Attribute,
			// XML_ENTITY_DECL_NODE => 17,
			XML_NAMESPACE_DECL_NODE => XPathNodeType::NamespaceURI,
		);

	}
905534
public function ucfirst(){
		
		if($this->isNullOrWhitespace()){
			return clone $this;
		}
		else if($this->count() === 1){
			return new static(\mb_strtoupper($this->_Value, $this->_Encoding),
					$this->_Encoding);
		}
		
		$str = $this[0]->ucfirst() . $this->substring(1);
		
		return new static($str, $this->_Encoding);
		
	}
516217
public static function factory(string $alphabet, string $ph, string $text): Phoneme
    {
        $instance = new static();
        $instance->alphabet = $alphabet;
        $instance->ph = $ph;
        $instance->text = $text;

        return $instance;
    }
997220
public static function parse($color)
    {
        $hsl = '/hsl\(([0-9]{1,3}),\s*([0-9]{1,3})%,\s*([0-9]{1,3})%\)/';
        $rgb = '/rgb\(([0-9]{1,3}),\s*([0-9]{1,3}),\s*([0-9]{1,3})\)/';

        // HSL
        if (preg_match($hsl, $color, $m)) {
            return static::hsl((int)$m[1], (int)$m[2] / 100, (int)$m[3] / 100);
        } // RGB
        elseif (preg_match($rgb, $color, $m)) {
            return static::rgb((int)$m[1], (int)$m[2], (int)$m[3]);
        } // Hex
        else {
            return static::hex($color);
        };

    }
696042
public function call_static() {
		$args  = func_get_args();
		$class = array_shift( $args );
		$name  = array_shift( $args );

		return call_user_func_array( [$class, $name], $args );
	}
1289516
function decChar(char, base = 10) {
  let val = charToVal(char);
  if (val < 0) throw new Error('in decChar, invalid character');
  val = (val + base - 1) % base;
  return consts.alphabet[val];
}