<commit_before><?php

namespace Ilios\CoreBundle\Controller;

use FOS\RestBundle\Controller\Annotations\QueryParam;
use FOS\RestBundle\Controller\Annotations\RouteResource;
use FOS\RestBundle\Controller\Annotations as Rest;
use FOS\RestBundle\Request\ParamFetcherInterface;
use FOS\RestBundle\Util\Codes;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use FOS\RestBundle\Controller\FOSRestController;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Ilios\CoreBundle\Handler\IngestionExceptionHandler;
use Ilios\CoreBundle\Entity\IngestionExceptionInterface;

/**
 * Class IngestionExceptionController
 * @package Ilios\CoreBundle\Controller
 * @RouteResource("IngestionExceptions")
 *
 * @deprecated
 */
class IngestionExceptionController extends FOSRestController
{
    /**
     * Get a IngestionException
     *
     * @ApiDoc(
     *   section = "IngestionException",
     *   description = "Get a IngestionException.",
     *   resource = true,
     *   requirements={
     *     {
     *        "name"="id",
     *        "dataType"="integer",
     *        "requirement"="\d+",
     *        "description"="IngestionException identifier."
     *     }
     *   },
     *   output="Ilios\CoreBundle\Entity\IngestionException",
     *   statusCodes={
     *     200 = "IngestionException.",
     *     404 = "Not Found."
     *   },
     *   deprecated = true
     * )
     *
     * @Rest\View(serializerEnableMaxDepthChecks=true)
     *
     * @param $id
     *
     * @return Response
     */
    public function getAction($id)
    {
        $ingestionException = $this->getOr404($id);

        $authChecker = $this->get('security.authorization_checker');
        if (! $authChecker->isGranted('view', $ingestionException)) {
            throw $this->createAccessDeniedException('Unauthorized access!');
        }

        $answer['ingestionExceptions'][] = $ingestionException;

        return $answer;
    }

    /**
     * Get all IngestionException.
     *
     * @ApiDoc(
     *   section = "IngestionException",
     *   description = "Get all IngestionException.",
     *   resource = true,
     *   output="Ilios\CoreBundle\Entity\IngestionException",
     *   statusCodes = {
     *     200 = "List of all IngestionException",
     *     204 = "No content. Nothing to list."
     *   },
     *   deprecated = true
     * )
     *
     * @QueryParam(
     *   name="offset",
     *   requirements="\d+",
     *   nullable=true,
     *   description="Offset from which to start listing notes."
     * )
     * @QueryParam(
     *   name="limit",
     *   requirements="\d+",
     *   default="20",
     *   description="How many notes to return."
     * )
     * @QueryParam(
     *   name="order_by",
     *   nullable=true,
     *   array=true,
     *   description="Order by fields. Must be an array ie. &order_by[name]=ASC&order_by[description]=DESC"
     * )
     * @QueryParam(
     *   name="filters",
     *   nullable=true,
     *   array=true,
     *   description="Filter by fields. Must be an array ie. &filters[id]=3"
     * )
     *
     * @Rest\View(serializerEnableMaxDepthChecks=true)
     *<commit_msg>ingestion exception controller actions are not deprecated.<commit_after><?php

namespace Ilios\CoreBundle\Controller;

use FOS\RestBundle\Controller\Annotations\QueryParam;
use FOS\RestBundle\Controller\Annotations\RouteResource;
use FOS\RestBundle\Controller\Annotations as Rest;
use FOS\RestBundle\Request\ParamFetcherInterface;
use FOS\RestBundle\Util\Codes;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use FOS\RestBundle\Controller\FOSRestController;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Ilios\CoreBundle\Handler\IngestionExceptionHandler;
use Ilios\CoreBundle\Entity\IngestionExceptionInterface;

/**
 * Class IngestionExceptionController
 * @package Ilios\CoreBundle\Controller
 * @RouteResource("IngestionExceptions")
 *
 * @deprecated
 */
class IngestionExceptionController extends FOSRestController
{
    /**
     * Get a IngestionException
     *
     * @ApiDoc(
     *   section = "IngestionException",
     *   description = "Get a IngestionException.",
     *   resource = true,
     *   requirements={
     *     {
     *        "name"="id",
     *        "dataType"="integer",
     *        "requirement"="\d+",
     *        "description"="IngestionException identifier."
     *     }
     *   },
     *   output="Ilios\CoreBundle\Entity\IngestionException",
     *   statusCodes={
     *     200 = "IngestionException.",
     *     404 = "Not Found."
     *   }
     * )
     *
     * @Rest\View(serializerEnableMaxDepthChecks=true)
     *
     * @param $id
     *
     * @return Response
     */
    public function getAction($id)
    {
        $ingestionException = $this->getOr404($id);

        $authChecker = $this->get('security.authorization_checker');
        if (! $authChecker->isGranted('view', $ingestionException)) {
            throw $this->createAccessDeniedException('Unauthorized access!');
        }

        $answer['ingestionExceptions'][] = $ingestionException;

        return $answer;
    }

    /**
     * Get all IngestionException.
     *
     * @ApiDoc(
     *   section = "IngestionException",
     *   description = "Get all IngestionException.",
     *   resource = true,
     *   output="Ilios\CoreBundle\Entity\IngestionException",
     *   statusCodes = {
     *     200 = "List of all IngestionException",
     *     204 = "No content. Nothing to list."
     *   }
     * )
     *
     * @QueryParam(
     *   name="offset",
     *   requirements="\d+",
     *   nullable=true,
     *   description="Offset from which to start listing notes."
     * )
     * @QueryParam(
     *   name="limit",
     *   requirements="\d+",
     *   default="20",
     *   description="How many notes to return."
     * )
     * @QueryParam(
     *   name="order_by",
     *   nullable=true,
     *   array=true,
     *   description="Order by fields. Must be an array ie. &order_by[name]=ASC&order_by[description]=DESC"
     * )
     * @QueryParam(
     *   name="filters",
     *   nullable=true,
     *   array=true,
     *   description="Filter by fields. Must be an array ie. &filters[id]=3"
     * )
     *
     * @Rest\View(serializerEnableMaxDepthChecks=true)
     *
{'fraction_non_alphanumeric': 0.12725590004627488, 'fraction_numerical': 0.005552984729291994, 'mean_word_length': 2.6102449888641424, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '7659729', 'n_tokens_mistral': 2020, 'n_tokens_neox': 1993, 'n_words': 326}