<commit_before><?php

require_once './../vendor/autoload.php';

$app = new \Silex\Application(['debug' => true]);

$app->register(new \Glaubinix\Silex\Provider\ParamConverterProvider());

// Flash example
$app->register(new \Silex\Provider\SessionServiceProvider());
$app->get('/flash', function(\QafooLabs\MVC\Flash $flashBag) {
    $flashBag->add('error', 'flashy');

    return new \Symfony\Component\HttpFoundation\Response('flash added');
});

// Token context example
$app->register(new \Silex\Provider\SecurityServiceProvider(),
    [
        'security.firewalls' => [
            'unsecured' => [
                'anonymous' => true,
            ]
        ]
    ]
);

$app->get('/security', function(\QafooLabs\MVC\TokenContext $context) {
    if ($context->hasNonAnonymousToken()) {
        $userName = $context->getCurrentUser()->getUsername();
        return new \Symfony\Component\HttpFoundation\Response(sprintf('user: %s', $userName));
    } else {
        return new \Symfony\Component\HttpFoundation\Response('anonymous user');
    }
});

$app->run();<commit_msg>param converter form example<commit_after><?php

require_once './../vendor/autoload.php';

$app = new \Silex\Application(['debug' => true]);

$app->register(new \Glaubinix\Silex\Provider\ParamConverterProvider());

// Flash example
$app->register(new \Silex\Provider\SessionServiceProvider());
$app->get('/flash', function(\QafooLabs\MVC\Flash $flashBag) {
    $flashBag->add('error', 'flashy');

    return new \Symfony\Component\HttpFoundation\Response('flash added');
});

// Token context example
$app->register(new \Silex\Provider\SecurityServiceProvider(),
    [
        'security.firewalls' => [
            'unsecured' => [
                'anonymous' => true,
            ]
        ]
    ]
);

$app->get('/security', function(\QafooLabs\MVC\TokenContext $context) {
    if ($context->hasNonAnonymousToken()) {
        $userName = $context->getCurrentUser()->getUsername();
        return new \Symfony\Component\HttpFoundation\Response(sprintf('user: %s', $userName));
    } else {
        return new \Symfony\Component\HttpFoundation\Response('anonymous user');
    }
});

// FormRequest example (will throw an exception because no form is defined)
$app->register(new \Silex\Provider\FormServiceProvider());
$app->get('/form', function(\QafooLabs\MVC\FormRequest $formRequest) {
    $formRequest->getForm('dummyform');
});

$app->run();
{'fraction_non_alphanumeric': 0.17863036303630364, 'fraction_numerical': 0.0, 'mean_word_length': 3.636711281070746, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 34, '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': '7363360', 'n_tokens_mistral': 750, 'n_tokens_neox': 742, 'n_words': 117}