<commit_before><?php

    namespace neoform\entity\generate;

    use neoform\sql\parser\field;
    use neoform\entity\generate;

    class model extends generate {

        protected $used_function_names = [];

        protected function used($name) {
            $suffix     = '';
            $final_name = $name;
            $i          = 1;
            while (in_array($final_name, $this->used_function_names)) {
                $final_name = $name . $suffix;
                $suffix     = $i++;
            }
            $this->used_function_names[] = $final_name;
            return $final_name;
        }

        public function get() {

//            $enum_values = [
//                "'yes','no'"     => 'yes',
//                "'no','yes'"     => 'yes',
//                "'true','false'" => 'true',
//                "'false','true'" => 'true',
//            ];

            $ints    = [];
            $floats  = [];
            $dates   = [];
            $bools   = [];
            $strings = [];

            foreach ($this->table->fields as $field) {
                switch ($field->casting_extended) {
                    case 'int':
                    case 'integer':
                        $ints[] = $field;
                        break;

                    case 'float':
                        $floats[] = $field;
                        break;

                    case 'date':
                    case 'datetime':
                        $dates[] = $field;
                        break;

                    case 'bool':
                    case 'boolean':
                        $bools[] = $field;

                    default:
                        $strings[] = $field;
                        break;
                }
            }

            $this->code .= "\t\tpublic function __get(\$k) {\n\n";
            $this->code .= "\t\t\tif (isset(\$this->vars[\$k])) {\n";
            $this->code .= "\t\t\t\tswitch (\$k) {\n";

            // INTS
            if (count($ints)) {
                $this->code .= "\t\t\t\t\t// integers\n";
                foreach ($ints as $int) {
                    $this->code .= "\t\t\t\t\tcase '{$int->name}':\n";
                }
                $this->code .= "\t\t\t\t\t\treturn (int) \$this->vars[\$k];\n\n";<commit_msg>Fixed bug in generator for boolean model vars.<commit_after><?php

    namespace neoform\entity\generate;

    use neoform\sql\parser\field;
    use neoform\entity\generate;

    class model extends generate {

        protected $used_function_names = [];

        protected function used($name) {
            $suffix     = '';
            $final_name = $name;
            $i          = 1;
            while (in_array($final_name, $this->used_function_names)) {
                $final_name = $name . $suffix;
                $suffix     = $i++;
            }
            $this->used_function_names[] = $final_name;
            return $final_name;
        }

        public function get() {

//            $enum_values = [
//                "'yes','no'"     => 'yes',
//                "'no','yes'"     => 'yes',
//                "'true','false'" => 'true',
//                "'false','true'" => 'true',
//            ];

            $ints    = [];
            $floats  = [];
            $dates   = [];
            $bools   = [];
            $strings = [];

            foreach ($this->table->fields as $field) {
                switch ($field->casting_extended) {
                    case 'int':
                    case 'integer':
                        $ints[] = $field;
                        break;

                    case 'float':
                        $floats[] = $field;
                        break;

                    case 'date':
                    case 'datetime':
                        $dates[] = $field;
                        break;

                    case 'bool':
                    case 'boolean':
                        $bools[] = $field;
                        break;

                    default:
                        $strings[] = $field;
                        break;
                }
            }

            $this->code .= "\t\tpublic function __get(\$k) {\n\n";
            $this->code .= "\t\t\tif (isset(\$this->vars[\$k])) {\n";
            $this->code .= "\t\t\t\tswitch (\$k) {\n";

            // INTS
            if (count($ints)) {
                $this->code .= "\t\t\t\t\t// integers\n";
                foreach ($ints as $int) {
                    $this->code .= "\t\t\t\t\tcase '{$int->name}':\n";
                }
                $this->code .= "\t\t\t\t\t\treturn (int) \$this->vars[\$k];\n\n";
{'fraction_non_alphanumeric': 0.16201117318435754, 'fraction_numerical': 0.0004297378599054577, 'mean_word_length': 0.9363560732113144, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, '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': '3387867', 'n_tokens_mistral': 1343, 'n_tokens_neox': 1219, 'n_words': 237}