<commit_before><?php

declare(strict_types=1);

namespace Inowas\ScenarioAnalysisBundle\Controller;

use FOS\RestBundle\Controller\Annotations as Rest;
use FOS\RestBundle\Controller\FOSRestController;
use FOS\RestBundle\Request\ParamFetcher;
use HeatMap\HeatMap;
use Inowas\Modflow\Model\CalculationResultType;
use Inowas\Modflow\Model\LayerNumber;
use Inowas\Modflow\Model\ModflowId;
use Inowas\Modflow\Model\TotalTime;
use Inowas\Modflow\Model\UserId;
use Inowas\ScenarioAnalysisBundle\Exception\InvalidArgumentException;
use Inowas\ScenarioAnalysisBundle\Exception\InvalidUuidException;
use Nelmio\ApiDocBundle\Annotation\ApiDoc as ApiDoc;
use Ramsey\Uuid\Uuid;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;

class ScenarioAnalysisController extends FOSRestController
{

    /**
     * Get list of scenarioAnalysis-project by UserId.
     *
     * @ApiDoc(
     *   resource = true,
     *   description = "Get list of scenarioAnalysis-project by UserId.",
     *   statusCodes = {
     *     200 = "Returned when successful"
     *   }
     * )
     *
     * @Rest\Get("/user/{userId}")
     * @param $userId
     * @return JsonResponse
     */
    public function getScenarioAnalysisModelsByUserAction($userId): JsonResponse
    {
        $userId = UserId::fromString($userId);

        return new JsonResponse(
            $this->get('inowas.modflow_projection.model_details_finder')
                ->findByBaseUserId($userId)
        );
    }<commit_msg>Add route to scenarioanalysis/my/projects<commit_after><?php

declare(strict_types=1);

namespace Inowas\ScenarioAnalysisBundle\Controller;

use FOS\RestBundle\Controller\Annotations as Rest;
use FOS\RestBundle\Controller\FOSRestController;
use FOS\RestBundle\Request\ParamFetcher;
use HeatMap\HeatMap;
use Inowas\AppBundle\Model\User;
use Inowas\Modflow\Model\CalculationResultType;
use Inowas\Modflow\Model\LayerNumber;
use Inowas\Modflow\Model\ModflowId;
use Inowas\Modflow\Model\TotalTime;
use Inowas\Modflow\Model\UserId;
use Inowas\ScenarioAnalysisBundle\Exception\InvalidArgumentException;
use Inowas\ScenarioAnalysisBundle\Exception\InvalidUuidException;
use Nelmio\ApiDocBundle\Annotation\ApiDoc as ApiDoc;
use Ramsey\Uuid\Uuid;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;

class ScenarioAnalysisController extends FOSRestController
{

    /**
     * Get list of my scenarioAnalysis-projects.
     *
     * @ApiDoc(
     *   resource = true,
     *   description = "Get list of my scenarioAnalysis-projects.",
     *   statusCodes = {
     *     200 = "Returned when successful"
     *   }
     * )
     *
     * @Rest\Get("/my/projects")
     * @return JsonResponse
     */
    public function getScenarioAnalysisMyProjectsAction(): JsonResponse
    {

        $user = $this->getUser();

        if ($user instanceof User && $user->getId()) {
            $userId = UserId::fromString($this->getUser()->getId()->toString());
            return new JsonResponse(
                $this->get('inowas.modflow_projection.model_details_finder')
                    ->findByBaseUserId($userId)
            );
        }

        return new JsonResponse([]);
    }

    /**
     * Get list of scenarioAnalysis-project by UserId.
     *
     * @ApiDoc(
     *   resource = true,
     *   description = "Get list of scenarioAnalysis-project by UserId.",
     *   statusCodes = {
     *     200 = "Returned when successful"
     *   }
     * )
     *
     * @Rest\Get("/user/{userId}")
     * @param $userId
     * @return JsonResponse
     */
    public function getScenarioAnalysisModelsByUserAction($userId): JsonResponse
    {
        $userId = UserId::fromString($userId);

        return new JsonResponse(
            $this->get('inowas.modflow_projection.model_details_finder')
                ->findByBaseUserId($userId)
        );
    }
{'fraction_non_alphanumeric': 0.10741687979539642, 'fraction_numerical': 0.002813299232736573, 'mean_word_length': 3.1695095948827294, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '5938538', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1179, 'n_words': 206}