<commit_before><?php
class Kwf_Assets_Provider_BowerBuiltFile extends Kwf_Assets_Provider_Abstract
{
    private $_path;
    public function __construct($path)
    {
        $path = substr($path, strlen(VENDOR_PATH.'/bower_components/'));
        $this->_path = $path;
    }

    public function getDependency($dependencyName)
    {
        if (strtolower($dependencyName) == $this->_path || strtolower($dependencyName).'.js' == $this->_path) {
            $dir = VENDOR_PATH.'/bower_components/'.$this->_path;
            $path = $this->_path;
            if (substr($path, -3) == '.js') $path = substr($path, 0, -3);
            $type = $path;
            if (substr($type, -2) == 'js') $type = substr($type, 0, -2);
            if (substr($path, -3) == '-js') $path = substr($path, 0, -3);
            $files = array(
                $path.'.js',
                'dist/'.$path.'.js',
                'build/'.$path.'.js',
                'src/'.$path.'.js',
                'js/'.$path.'.js',
                $path.'/'.$path.'.js',
            );
            foreach ($files as $f) {
                if (substr($f, -6) == '.js.js') $f = substr($f, 0, -3);
                if (file_exists($dir.'/'.$f)) {
                    if (file_exists($dir.'/'.substr($f, 0, -2).'css')) {
                        return new Kwf_Assets_Dependency_Dependencies(array(
                            new Kwf_Assets_Dependency_File_Js($type.'/'.$f),
                            new Kwf_Assets_Dependency_File_Css($type.'/'.substr($f, 0, -2).'css'),
                        ), $dependencyName);
                    } else {
                        return new Kwf_Assets_Dependency_File_Js($type.'/'.$f);
                    }
                }
            }
            throw new Kwf_Exception("Can't find built dependency for $dependencyName in vendor/bower_components/$this->_path");
        } else if (substr($dependencyName, 0, 8) == 'FontFace' && strlen($dependencyName) > 8) {
            //eg. FontFaceIcomoon, FontFaceFontAwesome, FontFaceIonicons
            $bowerName = lcfirst(substr($dependencyName, 8));

            if (file_exists('vendor/bower_components/'.$bowerName.'/fonts.css')) {
                return new Kwf_Assets_Dependency_File_Css($bowerName.'/fonts.css');
            } else if (file_exists('vendor/bower_components/'.$bowerName.'-font/fonts.css')) {
                return new Kwf_Assets_Dependency_File_Css($bowerName.'-font/fonts.css');
            } else if (file_exists('vendor/bower_components/'.$bowerName.'-fonts/fonts.css')) {
                return new Kwf_Assets_Dependency_File_Css($bowerName.'-fonts/fonts.css');

            } else if (file_exists('vendor/bower_components/'.$bowerName)) {
                return new Kwf_Assets_Dependency_FontFace($bowerName, $bowerName);
            } else if (file_exists('vendor/bower_components/'.$bowerName.'-font')) {
                return new Kwf_Assets_Dependency_FontFace($bowerName, $bowerName.'-font');
            } else if (file_exists('vendor/bower_components/'.$bowerName.'-fonts')) {<commit_msg>php 5.2 compatibility: lcfrist doesn't exist in php 5.2<commit_after><?php
class Kwf_Assets_Provider_BowerBuiltFile extends Kwf_Assets_Provider_Abstract
{
    private $_path;
    public function __construct($path)
    {
        $path = substr($path, strlen(VENDOR_PATH.'/bower_components/'));
        $this->_path = $path;
    }

    public function getDependency($dependencyName)
    {
        if (strtolower($dependencyName) == $this->_path || strtolower($dependencyName).'.js' == $this->_path) {
            $dir = VENDOR_PATH.'/bower_components/'.$this->_path;
            $path = $this->_path;
            if (substr($path, -3) == '.js') $path = substr($path, 0, -3);
            $type = $path;
            if (substr($type, -2) == 'js') $type = substr($type, 0, -2);
            if (substr($path, -3) == '-js') $path = substr($path, 0, -3);
            $files = array(
                $path.'.js',
                'dist/'.$path.'.js',
                'build/'.$path.'.js',
                'src/'.$path.'.js',
                'js/'.$path.'.js',
                $path.'/'.$path.'.js',
            );
            foreach ($files as $f) {
                if (substr($f, -6) == '.js.js') $f = substr($f, 0, -3);
                if (file_exists($dir.'/'.$f)) {
                    if (file_exists($dir.'/'.substr($f, 0, -2).'css')) {
                        return new Kwf_Assets_Dependency_Dependencies(array(
                            new Kwf_Assets_Dependency_File_Js($type.'/'.$f),
                            new Kwf_Assets_Dependency_File_Css($type.'/'.substr($f, 0, -2).'css'),
                        ), $dependencyName);
                    } else {
                        return new Kwf_Assets_Dependency_File_Js($type.'/'.$f);
                    }
                }
            }
            throw new Kwf_Exception("Can't find built dependency for $dependencyName in vendor/bower_components/$this->_path");
        } else if (substr($dependencyName, 0, 8) == 'FontFace' && strlen($dependencyName) > 8) {
            //eg. FontFaceIcomoon, FontFaceFontAwesome, FontFaceIonicons
            $bowerName = substr($dependencyName, 8);
            $bowerName[0] = strtolower($bowerName[0]);

            if (file_exists('vendor/bower_components/'.$bowerName.'/fonts.css')) {
                return new Kwf_Assets_Dependency_File_Css($bowerName.'/fonts.css');
            } else if (file_exists('vendor/bower_components/'.$bowerName.'-font/fonts.css')) {
                return new Kwf_Assets_Dependency_File_Css($bowerName.'-font/fonts.css');
            } else if (file_exists('vendor/bower_components/'.$bowerName.'-fonts/fonts.css')) {
                return new Kwf_Assets_Dependency_File_Css($bowerName.'-fonts/fonts.css');

            } else if (file_exists('vendor/bower_components/'.$bowerName)) {
                return new Kwf_Assets_Dependency_FontFace($bowerName, $bowerName);
            } else if (file_exists('vendor/bower_components/'.$bowerName.'-font')) {
                return new Kwf_Assets_Dependency_FontFace($bowerName, $bowerName.'-font');
            } else if (file_exists('vendor/bower_components/'.$bowerName.'-fonts')) {
{'fraction_non_alphanumeric': 0.16361886429258904, 'fraction_numerical': 0.007378889958293231, 'mean_word_length': 2.0208333333333335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '4876597', 'n_tokens_mistral': 2000, 'n_tokens_neox': 1903, 'n_words': 314}