<commit_before><?php

namespace Formulaic;

class Bitflag extends Checkbox\Group
{
    protected $value = 0;

    public function setValue($value)
    {
        if (is_array($value)) {
            $bit = 0;
            foreach ($value as $one) {
                $bit |= $one;
            }
            $value = $bit;
        }
        $this->value = $value;
        foreach ((array)$this as $element) {
            if ($value & $element->getElement()->getValue()) {
                $element->getElement()->check();
            } else {
                $element->getElement()->check(false);
            }
        }
    }
}

<commit_msg>better handling of turning these on/off<commit_after><?php

namespace Formulaic;

class Bitflag extends Checkbox\Group
{
    protected $value = 0;

    public function setValue($value)
    {
        $this->value |= $value;
        foreach ((array)$this as $element) {
            if ($value & $element->getElement()->getValue()) {
                $element->getElement()->check();
            } else {
                $element->getElement()->check(false);
                $this->value &= ~$element->getElement()->getValue();
            }
        }
    }

    public function & getValue()
    {
        return $this->value;
    }
}


{'fraction_non_alphanumeric': 0.1483820047355959, 'fraction_numerical': 0.0023677979479084454, 'mean_word_length': 1.6751054852320675, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '4690572', 'n_tokens_mistral': 350, 'n_tokens_neox': 337, 'n_words': 74}