<commit_before><?php
class Kwf_Assets_Dependency_HttpUrl extends Kwf_Assets_Dependency_Abstract
{
    private $_url;
    public function __construct($url)
    {
        $this->_url = $url;
    }

    public function getIncludeInPackage()
    {
        return false;
    }

    public function getUrl()
    {
        return $this->_url;
    }

    public function __toString()
    {
        return $this->_url;
    }

    public function getMimeType()
    {
        if (substr($this->_url, -4) == '.css') {
            return 'text/css';
        } else if (substr($this->_url, -3) == '.js') {
            return 'text/javascript';
        } else {
            throw new Kwf_Exception("Unknown file type");
        }
    }
}
<commit_msg>improve detecting mimetype for http urls<commit_after><?php
class Kwf_Assets_Dependency_HttpUrl extends Kwf_Assets_Dependency_Abstract
{
    private $_url;
    public function __construct($url)
    {
        $this->_url = $url;
    }

    public function getIncludeInPackage()
    {
        return false;
    }

    public function getUrl()
    {
        return $this->_url;
    }

    public function __toString()
    {
        return $this->_url;
    }

    public function getMimeType()
    {
        if (substr($this->_url, -4) == '.css') {
            return 'text/css';
        } else if (substr($this->_url, -3) == '.js') {
            return 'text/javascript';
        } else {
            $path = parse_url($this->_url, PHP_URL_PATH);
            if (substr($path, -4) == '/css') {
                return 'text/css';
            } else if (substr($path, -3) == '/js') {
                return 'text/javascript';
            }
            throw new Kwf_Exception("Unknown file type");
        }
    }
}

{'fraction_non_alphanumeric': 0.1311569301260023, 'fraction_numerical': 0.003436426116838488, 'mean_word_length': 1.8452768729641693, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4111227', 'n_tokens_mistral': 538, 'n_tokens_neox': 519, 'n_words': 119}