<commit_before><?php

use Slim\Http\Request;
use Slim\Http\Response;
use Tuum\Respond\Respond;

/**
 * routes
 * 
 * @var Slim\App $app
 */

/**
 * top page
 */
$app->get('/', function (Request $request, Response $response) {
    return Respond::view($request, $response)->asView('index');
});

/**
 * jump and jumper to see the redirection and parameter in flash
 */
$app->get('/jump', function ($request, Response $response) {
    return Respond::view($request, $response)
        ->asView('jump');
});

$app->post('/jumper', function (Request $request, Response $response) {
    return Respond::redirect($request, $response)
        ->withMessage('redirected back!')
        ->withInputData(['jumped' => 'redirected text'])
        ->withInputErrors(['jumped' => 'redirected error message'])
        ->toPath('jump');
});

/**
 * check asContents
 */
$app->get('/content', function(Request $request, Response $response) {
    return Respond::view($request, $response)
        ->asContents('<h1>Contents</h1><p>this is a string content in a layout file</p>');
});

/**
 * check uncaught exception
 */<commit_msg>fixed toPath with leading slash.<commit_after><?php

use Slim\Http\Request;
use Slim\Http\Response;
use Tuum\Respond\Respond;

/**
 * routes
 * 
 * @var Slim\App $app
 */

/**
 * top page
 */
$app->get('/', function (Request $request, Response $response) {
    return Respond::view($request, $response)->asView('index');
});

/**
 * jump and jumper to see the redirection and parameter in flash
 */
$app->get('/jump', function ($request, Response $response) {
    return Respond::view($request, $response)
        ->asView('jump');
});

$app->post('/jumper', function (Request $request, Response $response) {
    return Respond::redirect($request, $response)
        ->withMessage('redirected back!')
        ->withInputData(['jumped' => 'redirected text'])
        ->withInputErrors(['jumped' => 'redirected error message'])
        ->toPath('/jump');
});

/**
 * check asContents
 */
$app->get('/content', function(Request $request, Response $response) {
    return Respond::view($request, $response)
        ->asContents('<h1>Contents</h1><p>this is a string content in a layout file</p>');
});

/**
 * check uncaught exception
 */
{'fraction_non_alphanumeric': 0.19128113879003558, 'fraction_numerical': 0.0017793594306049821, 'mean_word_length': 3.878524945770065, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 37, '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': '2075187', 'n_tokens_mistral': 691, 'n_tokens_neox': 671, 'n_words': 170}