modify string based on dir char mapping and case sensitivity

@param  string $name the name to convert
@return string the converted name
544664
private function modifyName($name)
    {
        if (!$this->caseSensitive) {
            $name = strtolower($name);
        }
        if ($this->handleDirSep) {
            if (strpos('\\', $name) !== false) {
                $name = str_replace('\\', '/', $name);
            }
        }

        return $name;
    }
511489
private function coerceName( $name ) {
		$coercedName = DOMUtils::coerceName( $name );
		if ( $name !== $coercedName ) {
			$this->coerced = true;
		}
		return $coercedName;
	}
488232
protected function getName($name)
    {
        $name = parent::getName($name);

        // This fixes any URL encoded filename and sanitize it
        $name = strtolower(urldecode($name));

        // Replace spaces with a dash
        $name = preg_replace('!\s+!', '-', $name);

        // Remove odd characters
        return preg_replace('/[^A-Za-z0-9\-_\.]/', '', $name);
    }
373548
protected function canonicalizeName($name)
    {
        $cName = parent::canonicalizeName($name);
        $cName = trim($cName, '.');

        return $cName;
    }
537282
static function changeName($path, $name)
    {
        $f = self::fileInfo($path);
        return $f['dir'].$name.'.'.$f['ext'];
    }
749733
protected static function getNormalizedHeaderKey(string $name){
        static $convertCache = [];

        if(!isset($convertCache[$name])){
            $convertCache[$name]    = ucfirst(ucwords($name, "-"));
        }

        return $convertCache[$name];
    }
1123889
protected function rmdir($name = '')
    {
        $result = true;
        $name = preg_replace(array('!\.{1,2}/!', '!^/!', '!/$!'), '', $name);
        $name = $this->dirData.$name;
        if (is_dir($name))
        {
            $files = glob($name.'/{.*,*}', GLOB_BRACE);
            for ($i = 0; $i < count($files); $i++)
            {
                if (substr($files[$i], -2) == '/.' || substr($files[$i], -3) == '/..') continue;
                if (is_dir($files[$i])) $result = $this->rmdir(substr($files[$i], strlen($this->dirData)));
                elseif (is_file($files[$i])) $result = filedelete($files[$i]);
                if (!$result) break;
            }
            if ($result) $result = rmdir($name);
        }
        return $result;
    }
397915
protected function filterFilename($name)
    {
        // Fix illegal characters
        $filter = FileNameFilter::create();
        $parts = array_filter(preg_split("#[/\\\\]+#", $name));
        return implode('/', array_map(function ($part) use ($filter) {
            return $filter->filter($part);
        }, $parts));
    }
1106675
protected function cleanFileName($name)
    {
        $title = Str::ascii($name);

        // Convert all dashes/underscores into separator
        $flip = $separator = '-';
        $title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title);

        // Remove all characters that are not the separator, letters, numbers, whitespace or @.
        $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s@]+!u', '', mb_strtolower($title));

        // Replace all separator characters and whitespace by a single separator
        $title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title);

        return trim($title, $separator);
    }
787457
protected function shortName($name)
    {
        $name = str_replace('_', ' ', $name);
        $name = ucwords($name);

        return str_replace(' ', '', $name);
    }
1310918
protected function getFileName($name) {
		
		// defaults
		$fileName = "";
		$dirSep   = DIRECTORY_SEPARATOR;
		
		// test to see what kind of path was supplied
		$posDash  = strpos($name,"-");
		$posSlash = strpos($name,$dirSep);
		
		if (($posSlash === false) && ($posDash !== false)) {
			$fileName = $this->baseDir.$dirSep.$this->patternUtil->getPatternFileName($name);
		} else {
			$fileName = $this->baseDir.$dirSep.$name;
		}
		
		if (substr($fileName, 0 - strlen($this->extension)) !== $this->extension) {
			$fileName .= $this->extension;
		}
		
		return $fileName;
		
	}
203492
protected function replaceDollar($name)
    {
        if (preg_match('/\$/', $name)) {
            $name = preg_replace_callback('/\$([a-z])/', function ($matches) {
                return 'dollar' . ucfirst($matches[1]);
            }, $name);
        }

        return $name;
    }
1040522
public static function toNameStrict( string $name )
	{
		$len = strlen($name);
		if( $len < 1 || $len > 50 )
		{
			return false;
		}

		$name = str_replace("-", "_", $name);
		if(strpos($name, "__") !== false || $name[0] === "_" || $len > 1 && $name[$len-1] === "_")
		{
			return false;
		}

		if( strpos($name, "_") !== false || ! ctype_upper($name[0]) )
		{
			$name = self::toName($name);
		}

		if( is_numeric($name[0]) || preg_match('/[^a-zA-Z0-9]/', $name ) )
		{
			return false;
		}

		return $name;
	}
236582
protected function getOriginalName($name)
    {
        foreach (array_keys($this->headers) as $key) {
            if (strtolower($key) === strtolower($name)) {
                return $key;
            }
        }

        return false;
    }
1321455
public static function coerceName( $name ) {
		$coercedName =
			mb_encode_numericentity( mb_substr( $name, 0, 1, 'UTF-8' ),
				HTMLData::$nameStartCharConvTable, 'UTF-8', true ) .
			mb_encode_numericentity( mb_substr( $name, 1, null, 'UTF-8' ),
				HTMLData::$nameCharConvTable, 'UTF-8', true );
		$coercedName = preg_replace_callback( '/&#x([0-9A-F]*);/',
			function ( $m ) {
				return 'U' . str_pad( $m[1], 6, '0', STR_PAD_LEFT );
			},
			$coercedName );
		return $coercedName;
	}
852927
public static function get( $name = '' ) {
		$name = self::sanitize( $name );
		$filename = self::get_filename( $name );

		return $filename ? @file_get_contents( $filename ) : '';
	}
872260
public static function normalizeClassname(string $name): string
    {
        $name = self::normalizeReservedKeywords($name, 'Type');

        return ucfirst(self::camelCase($name, '{[^a-z0-9]+}i'));
    }