<commit_before><?php

namespace App\V1Module;

use Nette;
use Nette\Application\IRouter;
use Nette\Application\Routers\RouteList;
use Nette\Application\Routers\Route;
use App\V1Module\Router\GetRoute;
use App\V1Module\Router\PostRoute;
use App\V1Module\Router\PutRoute;
use App\V1Module\Router\DeleteRoute;
use App\V1Module\Router\PreflightRoute;


/**
 * Router factory for V1 module.
 */
class RouterFactory {

  use Nette\StaticClass;

  /**
   * Create router with all routes for V1 module.
   * @return IRouter
   */
  public static function createRouter() {
    $router = new RouteList("V1");

    $prefix = "v1";
    $router[] = new Route($prefix, "Default:default");
    $router[] = new PreflightRoute($prefix, "Default:preflight");

    self::createAuthRoutes($router, $prefix);
    self::createCommentsRoutes($router, "$prefix/comments");
    self::createBrokerReportsRoutes($router, "$prefix/broker-reports");
    self::createExercisesRoutes($router, "$prefix/exercises");
    self::createAssignmentsRoutes($router, "$prefix/exercise-assignments");
    self::createGroupsRoutes($router, "$prefix/groups");
    self::createInstancesRoutes($router, "$prefix/instances");
    self::createReferenceSolutionsRoutes($router, "$prefix/reference-solutions");
    self::createSubmissionRoutes($router, "$prefix/submissions");
    self::createUploadedFilesRoutes($router, "$prefix/uploaded-files");
    self::createUsersRoutes($router, "$prefix/users");
    self::createForgottenPasswordRoutes($router, "$prefix/forgotten-password");
    self::createRuntimeEnvironmentsRoutes($router, "$prefix/runtime-environments");

    return $router;
  }

  /**
   * Adds all Authentication endpoints to given router.
   * @param type $router
   * @param type $prefix Route prefix
   */
  private static function createAuthRoutes($router, $prefix) {
    $router[] = new PostRoute("$prefix/login", "Login:default");
    $router[] = new PostRoute("$prefix/login/refresh", "Login:refresh");
    $router[] = new PostRoute("$prefix/login/<serviceId>", "Login:external");
  }

  /**
   * Adds all BrokerReports endpoints to given router.
   * @param type $router
   * @param type $prefix Route prefix
   */
  private static function createBrokerReportsRoutes($router, $prefix) {
    $router[] = new PostRoute("$prefix/error", "BrokerReports:error");
    $router[] = new PostRoute("$prefix/job-status/<jobId>", "BrokerReports:jobStatus");
  }

  /**
   * Adds all Comments endpoints to given router.
   * @param type $router
   * @param type $prefix Route prefix
   */
  private static function createCommentsRoutes($router, $prefix) {
    $router[] = new GetRoute("$prefix/<id>", "Comments:default");
    $router[] = new PostRoute("$prefix/<id>", "Comments:addComment");
    $router[] = new PostRoute("$prefix/<threadId>/comment/<commentId>/toggle", "Comments:togglePrivate");
  }

  /**
   * Adds all Exercises endpoints to given router.
   * @param type $router
   * @param type $prefix Route prefix
   */
  private static function createExercisesRoutes($router, $prefix) {
    $router[] = new GetRoute("$prefix", "Exercises:");
    $router[] = new PostRoute("$prefix", "Exercises:create");
    $router[] = new GetRoute("$prefix/<id>", "Exercises:detail");
    $router[] = new PostRoute("$prefix/<id>", "Exercises:updateDetail");
    $router[] = new PostRoute("$prefix/<id>/runtime-configs", "Exercises:updateRuntimeConfigs");
    $router[] = new PostRoute("$prefix/<id>/fork", "Exercises:forkFrom");

    $router[] = new GetRoute("$prefix/<id>/supplementary-files", "Exercises:getSupplementaryFiles");
    $router[] = new PostRoute("$prefix/<id>/supplementary-files", "Exercises:uploadSupplementaryFile");
  }

  /**
   * Adds all Assignments endpoints to given router.
   * @param type $router
   * @param type $prefix Route prefix
   */
  private static function createAssignmentsRoutes($router, $prefix) {
    $router[] = new GetRoute("$prefix", "Assignments:");
    $router[] = new PostRoute("$prefix", "Assignments:create");
    $router[] = new GetRoute("$prefix/<id>", "Assignments:detail");
    $router[] = new PostRoute("$prefix/<id>", "Assignments:updateDetail");
    $router[] = new DeleteRoute("$prefix/<id>", "Assignments:remove");
    $router[] = new GetRoute("$prefix/<id>/can-submit", "Assignments:canSubmit");
    $router[] = new GetRoute("$prefix/<id>/users/<userId>/submissions", "Assignments:submissions");
    $router[] = new PostRoute("$prefix/<id>/submit", "Assignments:submit");
    $router[] = new GetRoute("$prefix/<id>/limits", "Assignments:getLimits");
    $router[] = new PostRoute("$prefix/<id>/limits", "Assignments:setLimits");
  }

  /**
   * Adds all Groups endpoints to given router.
   * @param type $router
   * @param type $prefix Route prefix
   */
  private static function createGroupsRoutes($router, $prefix) {
    $router[] = new GetRoute("$prefix", "Groups:");
    $router[] = new PostRoute("$prefix", "Groups:addGroup");
    $router[] = new PostRoute("$prefix/validate-add-group-data", "Groups:validateAddGroupData");
    $router[] = new GetRoute("$prefix/<id>", "Groups:detail");
    $router[] = new PostRoute("$prefix/<id>", "Groups:update");
    $router[] = new DeleteRoute("$prefix/<id>", "Groups:removeGroup");
    $router[] = new GetRoute("$prefix/<id>/subgroups", "Groups:subgroups");
    $router[] = new GetRoute("$prefix/<id>/members", "Groups:members");

    $router[] = new GetRoute("$prefix/<id>/students", "Groups:students");
    $router[] = new GetRoute("$prefix/<id>/students/stats", "Groups:stats");
    $router[] = new GetRoute("$prefix/<id>/students/<userId>", "Groups:studentsStats");
    $router[] = new GetRoute("$prefix/<id>/students/<userId>/best-results", "Groups:studentsBestResults");
    $router[] = new PostRoute("$prefix/<id>/students/<userId>", "Groups:addStudent");
    $router[] = new DeleteRoute("$prefix/<id>/students/<userId>", "Groups:removeStudent");

    $router[] = new GetRoute("$prefix/<id>/supervisors", "Groups:supervisors");
    $router[] = new PostRoute("$prefix/<id>/supervisors/<userId>", "Groups:addSupervisor");
    $router[] = new DeleteRoute("$prefix/<id>/supervisors/<userId>", "Groups:removeSupervisor");

    $router[] = new GetRoute("$prefix/<id>/admin", "Groups:admin");
    $router[] = new PostRoute("$prefix/<id>/admin", "Groups:makeAdmin");
<commit_msg>Wrong route fix<commit_after><?php

namespace App\V1Module;

use Nette;
use Nette\Application\IRouter;
use Nette\Application\Routers\RouteList;
use Nette\Application\Routers\Route;
use App\V1Module\Router\GetRoute;
use App\V1Module\Router\PostRoute;
use App\V1Module\Router\PutRoute;
use App\V1Module\Router\DeleteRoute;
use App\V1Module\Router\PreflightRoute;


/**
 * Router factory for V1 module.
 */
class RouterFactory {

  use Nette\StaticClass;

  /**
   * Create router with all routes for V1 module.
   * @return IRouter
   */
  public static function createRouter() {
    $router = new RouteList("V1");

    $prefix = "v1";
    $router[] = new Route($prefix, "Default:default");
    $router[] = new PreflightRoute($prefix, "Default:preflight");

    self::createAuthRoutes($router, $prefix);
    self::createCommentsRoutes($router, "$prefix/comments");
    self::createBrokerReportsRoutes($router, "$prefix/broker-reports");
    self::createExercisesRoutes($router, "$prefix/exercises");
    self::createAssignmentsRoutes($router, "$prefix/exercise-assignments");
    self::createGroupsRoutes($router, "$prefix/groups");
    self::createInstancesRoutes($router, "$prefix/instances");
    self::createReferenceSolutionsRoutes($router, "$prefix/reference-solutions");
    self::createSubmissionRoutes($router, "$prefix/submissions");
    self::createUploadedFilesRoutes($router, "$prefix/uploaded-files");
    self::createUsersRoutes($router, "$prefix/users");
    self::createForgottenPasswordRoutes($router, "$prefix/forgotten-password");
    self::createRuntimeEnvironmentsRoutes($router, "$prefix/runtime-environments");

    return $router;
  }

  /**
   * Adds all Authentication endpoints to given router.
   * @param type $router
   * @param type $prefix Route prefix
   */
  private static function createAuthRoutes($router, $prefix) {
    $router[] = new PostRoute("$prefix/login", "Login:default");
    $router[] = new PostRoute("$prefix/login/refresh", "Login:refresh");
    $router[] = new PostRoute("$prefix/login/<serviceId>", "Login:external");
  }

  /**
   * Adds all BrokerReports endpoints to given router.
   * @param type $router
   * @param type $prefix Route prefix
   */
  private static function createBrokerReportsRoutes($router, $prefix) {
    $router[] = new PostRoute("$prefix/error", "BrokerReports:error");
    $router[] = new PostRoute("$prefix/job-status/<jobId>", "BrokerReports:jobStatus");
  }

  /**
   * Adds all Comments endpoints to given router.
   * @param type $router
   * @param type $prefix Route prefix
   */
  private static function createCommentsRoutes($router, $prefix) {
    $router[] = new GetRoute("$prefix/<id>", "Comments:default");
    $router[] = new PostRoute("$prefix/<id>", "Comments:addComment");
    $router[] = new PostRoute("$prefix/<threadId>/comment/<commentId>/toggle", "Comments:togglePrivate");
  }

  /**
   * Adds all Exercises endpoints to given router.
   * @param type $router
   * @param type $prefix Route prefix
   */
  private static function createExercisesRoutes($router, $prefix) {
    $router[] = new GetRoute("$prefix", "Exercises:");
    $router[] = new PostRoute("$prefix", "Exercises:create");
    $router[] = new GetRoute("$prefix/<id>", "Exercises:detail");
    $router[] = new PostRoute("$prefix/<id>", "Exercises:updateDetail");
    $router[] = new PostRoute("$prefix/<id>/runtime-configs", "Exercises:updateRuntimeConfigs");
    $router[] = new PostRoute("$prefix/<id>/fork", "Exercises:forkFrom");

    $router[] = new GetRoute("$prefix/<id>/supplementary-files", "Exercises:getSupplementaryFiles");
    $router[] = new PostRoute("$prefix/<id>/supplementary-files", "Exercises:uploadSupplementaryFile");
  }

  /**
   * Adds all Assignments endpoints to given router.
   * @param type $router
   * @param type $prefix Route prefix
   */
  private static function createAssignmentsRoutes($router, $prefix) {
    $router[] = new GetRoute("$prefix", "Assignments:");
    $router[] = new PostRoute("$prefix", "Assignments:create");
    $router[] = new GetRoute("$prefix/<id>", "Assignments:detail");
    $router[] = new PostRoute("$prefix/<id>", "Assignments:updateDetail");
    $router[] = new DeleteRoute("$prefix/<id>", "Assignments:remove");
    $router[] = new GetRoute("$prefix/<id>/can-submit", "Assignments:canSubmit");
    $router[] = new GetRoute("$prefix/<id>/users/<userId>/submissions", "Assignments:submissions");
    $router[] = new PostRoute("$prefix/<id>/submit", "Assignments:submit");
    $router[] = new GetRoute("$prefix/<id>/limits", "Assignments:getLimits");
    $router[] = new PostRoute("$prefix/<id>/limits", "Assignments:setLimits");
  }

  /**
   * Adds all Groups endpoints to given router.
   * @param type $router
   * @param type $prefix Route prefix
   */
  private static function createGroupsRoutes($router, $prefix) {
    $router[] = new GetRoute("$prefix", "Groups:");
    $router[] = new PostRoute("$prefix", "Groups:addGroup");
    $router[] = new PostRoute("$prefix/validate-add-group-data", "Groups:validateAddGroupData");
    $router[] = new GetRoute("$prefix/<id>", "Groups:detail");
    $router[] = new PostRoute("$prefix/<id>", "Groups:updateGroup");
    $router[] = new DeleteRoute("$prefix/<id>", "Groups:removeGroup");
    $router[] = new GetRoute("$prefix/<id>/subgroups", "Groups:subgroups");
    $router[] = new GetRoute("$prefix/<id>/members", "Groups:members");

    $router[] = new GetRoute("$prefix/<id>/students", "Groups:students");
    $router[] = new GetRoute("$prefix/<id>/students/stats", "Groups:stats");
    $router[] = new GetRoute("$prefix/<id>/students/<userId>", "Groups:studentsStats");
    $router[] = new GetRoute("$prefix/<id>/students/<userId>/best-results", "Groups:studentsBestResults");
    $router[] = new PostRoute("$prefix/<id>/students/<userId>", "Groups:addStudent");
    $router[] = new DeleteRoute("$prefix/<id>/students/<userId>", "Groups:removeStudent");

    $router[] = new GetRoute("$prefix/<id>/supervisors", "Groups:supervisors");
    $router[] = new PostRoute("$prefix/<id>/supervisors/<userId>", "Groups:addSupervisor");
    $router[] = new DeleteRoute("$prefix/<id>/supervisors/<userId>", "Groups:removeSupervisor");

    $router[] = new GetRoute("$prefix/<id>/admin", "Groups:admin");
    $router[] = new PostRoute("$prefix/<id>/admin", "Groups:makeAdmin");

{'fraction_non_alphanumeric': 0.18390985737924515, 'fraction_numerical': 0.001575919943266882, 'mean_word_length': 5.128440366972477, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 89, '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': '3295476', 'n_tokens_mistral': 4013, 'n_tokens_neox': 3926, 'n_words': 772}