src/GenSynth.php
function get_language_name_from_extension($ext, $lookup = [])
    {
        $ext = strtolower($ext);

        if (!is_array($lookup) || empty($lookup)) {
            $lookup = [
                'as'      => 'actionscript',
                'as3'     => 'actionscript3',
                'conf'    => 'apache',
                'asp'     => 'asp',
                'sh'      => 'bash',
                'bf'      => 'bf',
                'c'       => 'c',
                'h'       => 'c',
                'cbl'     => 'cobol',
                'cpp'     => 'cpp',
                'hpp'     => 'cpp',
                'C'       => 'cpp',
                'H'       => 'cpp',
                'CPP'     => 'cpp',
                'HPP'     => 'cpp',
                'cs'      => 'csharp',
                'css'     => 'css',
                'bat'     => 'dos',
                'cmd'     => 'dos',
                'html'    => 'html',
                'htm'     => 'html',
                'ini'     => 'ini',
                'desktop' => 'ini',
                'java'    => 'java',
                'js'      => 'javascript',
                'sql'     => 'mysql',
                'pl'      => 'perl',
                'pm'      => 'perl',
                'php'     => 'php',
                'php5'    => 'php',
                'phtml'   => 'php',
                'phps'    => 'php',
                'py'      => 'python',
                'rb'      => 'ruby',
                'txt'     => 'text',
                'bas'     => 'vb',
                'vb'      => 'vbnet',
                'xml'     => 'xml',
                'svg'     => 'xml',
                'xrc'     => 'xml',
            ];
        }

        return $lookup[$ext] ?: 'text';
    }
function get_language_name_from_extension($ext, $lookup = [])
    {
        $ext = strtolower($ext);

        if (!is_array($lookup) || empty($lookup)) {
            $lookup = [
                'as'      => 'actionscript',
                'as3'     => 'actionscript3',
                'conf'    => 'apache',
                'asp'     => 'asp',
                'sh'      => 'bash',
                'bf'      => 'bf',
                'c'       => 'c',
                'h'       => 'c',
                'cbl'     => 'cobol',
                'cpp'     => 'cpp',
                'hpp'     => 'cpp',
                'C'       => 'cpp',
                'H'       => 'cpp',
                'CPP'     => 'cpp',
                'HPP'     => 'cpp',
                'cs'      => 'csharp',
                'css'     => 'css',
                'bat'     => 'dos',
                'cmd'     => 'dos',
                'html'    => 'html',
                'htm'     => 'html',
                'ini'     => 'ini',
                'desktop' => 'ini',
                'java'    => 'java',
                'js'      => 'javascript',
                'sql'     => 'mysql',
                'pl'      => 'perl',
                'pm'      => 'perl',
                'php'     => 'php',
                'php5'    => 'php',
                'phtml'   => 'php',
                'phps'    => 'php',
                'py'      => 'python',
                'rb'      => 'ruby',
                'txt'     => 'text',
                'bas'     => 'vb',
                'vb'      => 'vbnet',
                'xml'     => 'xml',
                'svg'     => 'xml',
                'xrc'     => 'xml',
            ];
        }

        return $lookup[$ext] ?: 'text';
    }
function get_language_name_from_extension ( $ ext , $ lookup = [ ] ) { $ ext = strtolower ( $ ext ) ; if ( ! is_array ( $ lookup ) || empty ( $ lookup ) ) { $ lookup = [ 'as' => 'actionscript' , 'as3' => 'actionscript3' , 'conf' => 'apache' , 'asp' => 'asp' , 'sh' => 'bash' , 'bf' => 'bf' , 'c' => 'c' , 'h' => 'c' , 'cbl' => 'cobol' , 'cpp' => 'cpp' , 'hpp' => 'cpp' , 'C' => 'cpp' , 'H' => 'cpp' , 'CPP' => 'cpp' , 'HPP' => 'cpp' , 'cs' => 'csharp' , 'css' => 'css' , 'bat' => 'dos' , 'cmd' => 'dos' , 'html' => 'html' , 'htm' => 'html' , 'ini' => 'ini' , 'desktop' => 'ini' , 'java' => 'java' , 'js' => 'javascript' , 'sql' => 'mysql' , 'pl' => 'perl' , 'pm' => 'perl' , 'php' => 'php' , 'php5' => 'php' , 'phtml' => 'php' , 'phps' => 'php' , 'py' => 'python' , 'rb' => 'ruby' , 'txt' => 'text' , 'bas' => 'vb' , 'vb' => 'vbnet' , 'xml' => 'xml' , 'svg' => 'xml' , 'xrc' => 'xml' , ] ; } return $ lookup [ $ ext ] ? : 'text' ; }
Given a file extension, this method returns either a valid GenSynth language
name, or the empty string if it couldn't be found

@param string The extension to get a language name for
@param array  A lookup array to use instead of the default one

@return string
Given a file extension this method returns either a valid GenSynth language name or the empty string if it couldn t be found