src/MDUrl/EncodeTrait.php
protected function &getEncodeCache($exclude)
    {
        if (array_key_exists($exclude, $this->encodeCache)) { return $this->encodeCache[$exclude]; }

        $cache = [];

        for ($i = 0; $i < 128; $i++) {
            // /^[0-9a-z]$/i
            if ( $i >= 0x30 && $i <= 0x39 ||
                $i >= 0x41 && $i <= 0x5a ||
                $i >= 0x61 && $i <= 0x7a ) {
                // always allow unencoded alphanumeric characters
                $cache[] = chr($i);
            } else {
                $cache[] = sprintf("%%%02X",$i);
            }
        }

        for ($i = 0, $l = strlen($exclude); $i < $l; $i++) $cache[ord($exclude[$i])] = $exclude[$i];


        $this->encodeCache[$exclude] = $cache;
        return $cache;
    }
protected function &getEncodeCache($exclude)
    {
        if (array_key_exists($exclude, $this->encodeCache)) { return $this->encodeCache[$exclude]; }

        $cache = [];

        for ($i = 0; $i < 128; $i++) {
            // /^[0-9a-z]$/i
            if ( $i >= 0x30 && $i <= 0x39 ||
                $i >= 0x41 && $i <= 0x5a ||
                $i >= 0x61 && $i <= 0x7a ) {
                // always allow unencoded alphanumeric characters
                $cache[] = chr($i);
            } else {
                $cache[] = sprintf("%%%02X",$i);
            }
        }

        for ($i = 0, $l = strlen($exclude); $i < $l; $i++) $cache[ord($exclude[$i])] = $exclude[$i];


        $this->encodeCache[$exclude] = $cache;
        return $cache;
    }
protected function & getEncodeCache ( $ exclude ) { if ( array_key_exists ( $ exclude , $ this -> encodeCache ) ) { return $ this -> encodeCache [ $ exclude ] ; } $ cache = [ ] ; for ( $ i = 0 ; $ i < 128 ; $ i ++ ) { // /^[0-9a-z]$/i if ( $ i >= 0x30 && $ i <= 0x39 || $ i >= 0x41 && $ i <= 0x5a || $ i >= 0x61 && $ i <= 0x7a ) { // always allow unencoded alphanumeric characters $ cache [ ] = chr ( $ i ) ; } else { $ cache [ ] = sprintf ( "%%%02X" , $ i ) ; } } for ( $ i = 0 , $ l = strlen ( $ exclude ) ; $ i < $ l ; $ i ++ ) $ cache [ ord ( $ exclude [ $ i ] ) ] = $ exclude [ $ i ] ; $ this -> encodeCache [ $ exclude ] = $ cache ; return $ cache ; }
Create a lookup array where anything but characters in `chars` string
and alphanumeric chars is percent-encoded.
@param string $exclude Ascii character staring
@return array
Create a lookup array where anything but characters in chars string and alphanumeric chars is percent - encoded .