<commit_before><?php
/**
 * Created by PhpStorm.
 * User: Adrien
 * Date: 11/10/2014
 * Time: 09:45
 */

if($argv[1] == 'generate')
{
    if($argv[2] == 'controller' && isset($argv[3]))
    {
        $filename = "controllers/{$argv[3]}.php";

        if(!file_exists($filename))
        {
            $file = fopen($filename, 'w') or die("Impossible de generer le fichier");
            fwrite($file, "<?php\n\nclass {$argv[3]} extends \Core\Controller\n{\n\tpublic function __construct()\n\t{\n\t\tparent::__construct();\n\t}\n}");
        }
        else
        {
            die("Le controller est deja present");
        }
    }
    else if($argv[2] == 'model' && isset($argv[3]))
    {
        $filename = "models/{$argv[3]}.php";

        if (!file_exists($filename)) {
            $file = fopen($filename, 'w') or die("Impossible de generer le fichier");
            fwrite($file, "<?php\n\nclass {$argv[3]} extends \Core\Model\n{\n\tpublic function __construct()\n\t{\n\t\tparent::__construct();\n\t\t\$this->table = \"table_name\";\n\t\t\$this->hidden = [];\n\t}\n}");
        }
        else
        {
            die("Le model est deja present");
        }
    }<commit_msg>Add load model when generate controller<commit_after><?php
/**
 * Created by PhpStorm.
 * User: Adrien
 * Date: 11/10/2014
 * Time: 09:45
 */

if($argv[1] == 'generate')
{
    if($argv[2] == 'controller' && isset($argv[3]))
    {
        $filename = "controllers/{$argv[3]}.php";

        if(!file_exists($filename))
        {
            $file = fopen($filename, 'w') or die("Impossible de generer le fichier");
            fwrite($file, "<?php\n\nclass {$argv[3]} extends \Core\Controller\n{\n\tpublic function __construct()\n\t{\n\t\tparent::__construct();\n\t\t\$this->page = \Core\Model::load('model_name');\n\t}\n}");
        }
        else
        {
            die("Le controller est deja present");
        }
    }
    else if($argv[2] == 'model' && isset($argv[3]))
    {
        $filename = "models/{$argv[3]}.php";

        if (!file_exists($filename)) {
            $file = fopen($filename, 'w') or die("Impossible de generer le fichier");
            fwrite($file, "<?php\n\nclass {$argv[3]} extends \Core\Model\n{\n\tpublic function __construct()\n\t{\n\t\tparent::__construct();\n\t\t\$this->table = \"table_name\";\n\t\t\$this->hidden = [];\n\t}\n}");
        }
        else
        {
            die("Le model est deja present");
        }
    }
{'fraction_non_alphanumeric': 0.21209644462607274, 'fraction_numerical': 0.0171638741315897, 'mean_word_length': 2.330612244897959, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 8, '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': '6555227', 'n_tokens_mistral': 877, 'n_tokens_neox': 854, 'n_words': 150}