<commit_before><?php

use Silex\Application;
use Silex\Provider\UrlGeneratorServiceProvider;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

//Load Composer AutoLoad File
require_once __DIR__.'/../vendor/autoload.php';

// Create a new instance of an silex application
$app = new Silex\Application();

// Register PropelOrm with the application
$app->register(new Propel\Silex\PropelServiceProvider(), array(
    'propel.config_file' => __DIR__.'/../config/propel/config.php'
));

// Register Twig with application
$app->register(new Silex\Provider\TwigServiceProvider(), array(
    'twig.path' => __DIR__.'/../app/views',
));

// Register UrlGenerator with application
$app->register(new UrlGeneratorServiceProvider());

//Register SessionServiceProvider with application
$app->register(new Silex\Provider\SessionServiceProvider());

//Register ServiceController with application
$app->register(new Silex\Provider\ServiceControllerServiceProvider());

//Turn on the app debugging
$app['debug'] = true;

//Register UserService Provider
$app->register(new \Koddi\User\UserServiceProvider());

//Define AuthController and inject UserService
$app['auth.controller'] = $app->share(function() use ($app) {
    return new \Koddi\Controller\AuthController($app['userService']);
});

$authBeforeFilter = function (Request $request, Application $app) {
    if (null === $user = $app['session']->get('user')) {
        return $app->redirect('/login');
    }
};

$app->get('/', function () use ($app) {
    return $app['twig']->render('hello.twig');
})->before($authBeforeFilter);

$app->get('/login', 'auth.controller:getLogin');

$app->get('/register', 'auth.controller:getRegister');
$app->post('/register', 'auth.controller:postRegister')->bind('post-register');

$app->run();<commit_msg>Add post-status and all-status routes<commit_after><?php

use Silex\Application;
use Silex\Provider\UrlGeneratorServiceProvider;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

//Load Composer AutoLoad File
require_once __DIR__.'/../vendor/autoload.php';

// Create a new instance of an silex application
$app = new Silex\Application();

// Register PropelOrm with the application
$app->register(new Propel\Silex\PropelServiceProvider(), array(
    'propel.config_file' => __DIR__.'/../config/propel/config.php'
));

// Register Twig with application
$app->register(new Silex\Provider\TwigServiceProvider(), array(
    'twig.path' => __DIR__.'/../app/views',
));

// Register UrlGenerator with application
$app->register(new UrlGeneratorServiceProvider());

//Register SessionServiceProvider with application
$app->register(new Silex\Provider\SessionServiceProvider());

//Register ServiceController with application
$app->register(new Silex\Provider\ServiceControllerServiceProvider());

//Turn on the app debugging
$app['debug'] = true;

//Register UserService Provider
$app->register(new \Koddi\User\UserServiceProvider());

//Register PostService provider
$app->register(new \Koddi\Post\PostServiceProvider());

//Define AuthController
$app['auth.controller'] = $app->share(function() use ($app) {
    return new \Koddi\Controller\AuthController();
});

//Define PostController
$app['post.controller'] = $app->share(function() use ($app) {
    return new \Koddi\Controller\PostController();
});

//Before Filter for authentication
$authBeforeFilter = function (Request $request, Application $app) {
    if (null === $user = $app['session']->get('user')) {
        return $app->redirect('/login');
    }
};

$app->get('/', function () use ($app) {
    return $app['twig']->render('home.twig');
})->before($authBeforeFilter);

$app->get('/login', 'auth.controller:getLogin');

$app->get('/register', 'auth.controller:getRegister');
$app->post('/register', 'auth.controller:postRegister')->bind('post-register');

$app->post('/post-status', 'post.controller:postStatus')->bind('post-status')->before($authBeforeFilter);

$app->get('/all-posts', 'post.controller:getAllPosts')->bind('all-posts')->before($authBeforeFilter);

$app->run();
{'fraction_non_alphanumeric': 0.17615571776155717, 'fraction_numerical': 0.0, 'mean_word_length': 5.630645161290323, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 49, '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': '175015', 'n_tokens_mistral': 1225, 'n_tokens_neox': 1216, 'n_words': 248}