<commit_before><?php

class EngineBlock_AttributeManipulator_File
{
    const FILE_NAME = 'manipulations.php';

    const ALLOWED_CHARACTERS_REGEX = '|[0-9a-zA-Z.-]|';

    protected $_fileLocation;

    public function manipulate($subjectId, array $attributes, array $response)
    {
        $this->_fileLocation = static::_getFileLocation();
        $attributes = $this->_doGeneralManipulation($subjectId, $attributes, $response);
        $attributes = $this->_doSpSpecificManipulation($subjectId, $attributes, $response);
        return $attributes;
    }

    protected function _doGeneralManipulation($subjectId, $attributes, $response)
    {
        $file = $this->_fileLocation . DIRECTORY_SEPARATOR . self::FILE_NAME;<commit_msg>Evil hack to have our cake (PHP 5.2 compability) and eat it too (testability of static methods in PHP 5.3)<commit_after><?php

class EngineBlock_AttributeManipulator_File
{
    const FILE_NAME = 'manipulations.php';

    const ALLOWED_CHARACTERS_REGEX = '|[0-9a-zA-Z.-]|';

    protected $_fileLocation;

    public function manipulate($subjectId, array $attributes, array $response)
    {
        if (floatval(phpversion()) >= 5.3) {
            // PHP 5.2 lexer doesn't enjoy the PHP 5.3 Late Static Binding 'static' keyword
            // for now we want compatibility, but we also want to make this testable,
            // so to compromise we use eval... for now...
            $this->_fileLocation = eval("static::_getFileLocation()");
        }
        else {
            $this->_fileLocation = self::_getFileLocation();            
        }
        $attributes = $this->_doGeneralManipulation($subjectId, $attributes, $response);
        $attributes = $this->_doSpSpecificManipulation($subjectId, $attributes, $response);
        return $attributes;
    }

    protected function _doGeneralManipulation($subjectId, $attributes, $response)
    {
        $file = $this->_fileLocation . DIRECTORY_SEPARATOR . self::FILE_NAME;
{'fraction_non_alphanumeric': 0.1173780487804878, 'fraction_numerical': 0.007113821138211382, 'mean_word_length': 3.2711496746203905, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '5824561', 'n_tokens_mistral': 576, 'n_tokens_neox': 553, 'n_words': 136}