<commit_before><?php

use RestAPI\Utils\ErrorResponse;
use RestAPI\Utils\HttpCodes;
use RestAPI\Utils\SuccessResponse;
use Slim\Http\Request as SlimRequest;
use Slim\Http\Response as SlimResponse;


// User session check
$app->get('/session/check', function (SlimRequest $request, SlimResponse $response)/* use ($DB)*/ {
  $data = [];
  try {

    $sessionPayload = SessionManager::checkSession($request);
    $data['session'] = "valid";
    $data['expiresIn'] = $sessionPayload->exp - time();

    return new SuccessResponse($response, $data);

  } catch (Exception $e) {
    return new ErrorResponse($response, $e, HttpCodes::UNATHORIZED);
  }
});

<commit_msg>Fixed session check<commit_after><?php

use RestAPI\Utils\APIResponse;

use RestAPI\Utils\HttpCodes;

use Slim\Http\Request as SlimRequest;
use Slim\Http\Response as SlimResponse;


// User session check
$app->get('/session/check', function (SlimRequest $request, SlimResponse $response)/* use ($DB)*/ {
  $data = [];
  try {

    $sessionPayload = SessionManager::checkSession($request);
    $data['session'] = "valid";
    $data['expiresIn'] = $sessionPayload->exp - time();

    return APIResponse::withSuccess($response, $data);

  } catch (Exception $e) {
    return APIResponse::witherror($response, $e, HttpCodes::UNATHORIZED);
  }
});


{'fraction_non_alphanumeric': 0.15990818668706963, 'fraction_numerical': 0.0, 'mean_word_length': 4.762114537444934, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2448400', 'n_tokens_mistral': 419, 'n_tokens_neox': 416, 'n_words': 92}