<commit_before><?php

class BMAttackShadow extends BMAttackPower {
    public $name = 'Shadow';
    public $type = 'Shadow';

    public function validate_attack($game, array $attackers, array $defenders) {
        return (1 == count($attackers) &&
                1 == count($defenders) &&
                $attackers[0]->max >= $defenders[0]->defense_value($this->type) &&
                $attackers[0]->attack_values($this->type)[0] <= $defenders[0]->defense_value($this->type) &&
                $attackers[0]->valid_attack($this->type, $attackers, $defenders) &&
                $defenders[0]->valid_target($this->type, $attackers, $defenders));
    }
}<commit_msg>Fixed code to work with PHP 5.3<commit_after><?php

class BMAttackShadow extends BMAttackPower {
    public $name = 'Shadow';
    public $type = 'Shadow';

    public function validate_attack($game, array $attackers, array $defenders) {
        if (1 != count($attackers) || 1 != count($defenders)) {
            return FALSE;
        }

        $attacker = $attackers[0];
        $defender = $defenders[0];

        $isDieLargeEnough = $attacker->max >=
                            $defender->defense_value($this->type);

        $attackValueArray = $attacker->attack_values($this->type);
        assert(1 == count($attackValueArray));
        $attackValue = $attackValueArray[0];
        $defenseValue = $defender->defense_value($this->type);
        $isValueSmallEnough = $attackValue <= $defenseValue;

        $canAttackerPerformThisAttack =
            $attacker->valid_attack($this->type, $attackers, $defenders);
        $isDefenderValidTargetForThisAttack =
            $defender->valid_target($this->type, $attackers, $defenders);

        return ($isDieLargeEnough &&
                $isValueSmallEnough &&
                $canAttackerPerformThisAttack &&
                $isDefenderValidTargetForThisAttack);
    }
}
{'fraction_non_alphanumeric': 0.14549288350026357, 'fraction_numerical': 0.008961518186610437, 'mean_word_length': 2.7733598409542743, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 27, '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': '3284037', 'n_tokens_mistral': 594, 'n_tokens_neox': 549, 'n_words': 95}