<commit_before><?php
session_start(); // required for CSRF
include(__DIR__.'/../autoload.php');
include('person.php');

$form = new Gregwar\Formidable\Form('forms/demoform.html', array(), true, null);

// Example for setting language to french
// $form->setLanguage(new Gregwar\Formidable\Language\French);

$form->addConstraint('firstname', function($value) {
    if ($value[0] == 'P') {
        return 'The firstname should not begin with a P!';
    }
});

$form->source('animals', array(
    'zebra' => 'Zebra',
    'bonobo' => 'Bonobo'
));

$errors = $form->handle(function() use ($form) {
    $data = $form->getData(new Person);
    var_dump($data);
});

?>
<!DOCTYPE html>
<html>
    <meta charset="utf-8" />
    <head>
        <title>Formidable Demo</title>
    </head> 
    <body>
        <h1>Formidable Demo</h1>
        <?php if ($errors) { ?>
            <div style="color:red">
                <h2>Validations error</h1>
                <ul>
                <?php foreach ($errors as $error) { ?>
                    <li><?php echo $error; ?></li>
                <?php } ?>
                </ul>
            </div>
        <?php } ?>
        <?php echo $form; ?>
    </body>
</html>
<commit_msg>Removing useless null in Form constructor<commit_after><?php
session_start(); // required for CSRF
include(__DIR__.'/../autoload.php');
include('person.php');

$form = new Gregwar\Formidable\Form('forms/demoform.html', array(), true);

// Example for setting language to french
// $form->setLanguage(new Gregwar\Formidable\Language\French);

$form->addConstraint('firstname', function($value) {
    if ($value[0] == 'P') {
        return 'The firstname should not begin with a P!';
    }
});

$form->source('animals', array(
    'zebra' => 'Zebra',
    'bonobo' => 'Bonobo'
));

$errors = $form->handle(function() use ($form) {
    $data = $form->getData(new Person);
    var_dump($data);
});

?>
<!DOCTYPE html>
<html>
    <meta charset="utf-8" />
    <head>
        <title>Formidable Demo</title>
    </head> 
    <body>
        <h1>Formidable Demo</h1>
        <?php if ($errors) { ?>
            <div style="color:red">
                <h2>Validations error</h1>
                <ul>
                <?php foreach ($errors as $error) { ?>
                    <li><?php echo $error; ?></li>
                <?php } ?>
                </ul>
            </div>
        <?php } ?>
        <?php echo $form; ?>
    </body>
</html>

{'fraction_non_alphanumeric': 0.19319114027891715, 'fraction_numerical': 0.004922067268252666, 'mean_word_length': 2.247669773635153, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 71, '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': '66610', 'n_tokens_mistral': 827, 'n_tokens_neox': 792, 'n_words': 178}