<commit_before><?php

namespace Formulaic;

abstract class Post extends Form
{
    public function __toString()
    {
        if ($this->hasFiles()) {
            $this->attributes['enctype'] = 'multipart/form-data';
        }
        $this->attributes['method'] = 'post';
        return parent::__toString();
    }

    public function populate()
    {
        $this->source($_POST);
        if ($this->hasFiles()) {
            $this->source($_FILES);
        }
        parent::populate();
    }

    private function hasFiles()
    {
        foreach ((array)$this as $element) {
            if (is_array($element)) {
                foreach ((array)$element as $field) {
                    if ($field instanceof File) {
                        return true;
                    }
                }
            } elseif ($element instanceof Label
                && $element->element() instanceof File
            ) {
                return true;
            } elseif ($element instanceof File) {
                return true;
            }
        }
        return false;
    }
}
<commit_msg>oops, this needs a prefix<commit_after><?php

namespace Formulaic;

abstract class Post extends Form
{
    public function __toString()
    {
        if ($this->hasFiles()) {
            $this->attributes['enctype'] = 'multipart/form-data';
        }
        $this->attributes['method'] = 'post';
        return parent::__toString();
    }

    public function populate()
    {
        $this->source($_POST);
        if ($this->hasFiles()) {
            $this->source($_FILES);
        }
        parent::populate();
    }

    private function hasFiles()
    {
        foreach ((array)$this as $element) {
            if (is_array($element)) {
                foreach ((array)$element as $field) {
                    if ($field instanceof File) {
                        return true;
                    }
                }
            } elseif ($element instanceof Label
                && $element->getElement() instanceof File
            ) {
                return true;
            } elseif ($element instanceof File) {
                return true;
            }
        }
        return false;
    }
}

{'fraction_non_alphanumeric': 0.1230140717203813, 'fraction_numerical': 0.0, 'mean_word_length': 1.4034896401308614, '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': '3162306', 'n_tokens_mistral': 561, 'n_tokens_neox': 540, 'n_words': 130}