public function generate_class()
    {

        /**
         * generates the spaces
         *
         * @param int $amount
         *
         * @return string
         */
        function gen_spaces($amount)
        {
            $spaces = '';
            for ($i = 0; $i < $amount; $i++) {
                $spaces .= ' ';
            }

            return $spaces;
        }

        if (empty($this->table_model)) {
            return false;
        }

        // general initiation of the object properties based on the
        $this->init();

        $this->generate_class_definition();
        if (strpos($this->class_name, '_') !== false) {
            $tmp = explode('_', $this->class_name);
            foreach ($tmp as $key => $part) {
                $tmp[$key] = ucfirst(strtolower($part));
            }
            $this->class_name = implode('_', $tmp);
        }

        $this->tpl_replacements['class_name'] = $this->class_name;
        $file                                 = new File();
        $file->open($this->tpl_path);

        $this->generated_code = $file->read();

        foreach ($this->tpl_replacements as $pattern => $value) {
            if (!is_string($value)) continue;

            $pattern              = '#' . strtoupper($pattern) . '#';
            $this->generated_code = str_replace($pattern, $value, $this->generated_code);
        }

        $this->generated_code = str_replace("\t", gen_spaces(self::SPACE_AMOUNT), $this->generated_code);

        return true;
    }