<commit_before><?php
namespace AppBundle\Controller\Api;


use JMS\DiExtraBundle\Annotation as DI;
use FOS\RestBundle\Controller\Annotations as Rest;
use Sensio\Bundle\FrameworkExtraBundle\Configuration as Sensio;
use AppBundle\Annotation as App;

use Nelmio\ApiDocBundle\Annotation\ApiDoc;

use AppBundle\Entity\Contact;
use AppBundle\Entity\Input\ContactPicture;
use AppBundle\Manager\ContactManager;
use AppBundle\Entity\Input\CreateContact;
use Symfony\Component\Validator\ConstraintViolationListInterface;
use Symfony\Component\HttpFoundation\Response;


/**
 * Class ContactController
 * @package AppBundle\Controller\Api
 *
 * @Sensio\Route("/contacts")
 * @App\RestResult
 */
class ContactController extends RestController
{

    /**
     * @var ContactManager
     */
    protected $contactManager;

    /**
     * @DI\InjectParams({
     *     "contactManager" = @DI\Inject("api.manager.contact")
     * })
     *
     * @param ContactManager $contactManager
     */
    public function __construct(ContactManager $contactManager)
    {
        $this->contactManager = $contactManager;
    }

    /**
     * @ApiDoc(input = "AppBundle\Entity\Input\CreateContact", views = {"default", "admin"})
     *
     * @Rest\Post("", name="api_post_contact")
     * @Sensio\ParamConverter("createContact", converter = "fos_rest.request_body")
     * @Rest\View(statusCode=201, serializerGroups={"default", "contact"})<commit_msg>allow adding contacts only for users<commit_after><?php
namespace AppBundle\Controller\Api;


use JMS\DiExtraBundle\Annotation as DI;
use FOS\RestBundle\Controller\Annotations as Rest;
use Sensio\Bundle\FrameworkExtraBundle\Configuration as Sensio;
use AppBundle\Annotation as App;

use Nelmio\ApiDocBundle\Annotation\ApiDoc;

use AppBundle\Entity\Contact;
use AppBundle\Entity\Input\ContactPicture;
use AppBundle\Manager\ContactManager;
use AppBundle\Entity\Input\CreateContact;
use Symfony\Component\Validator\ConstraintViolationListInterface;
use Symfony\Component\HttpFoundation\Response;


/**
 * Class ContactController
 * @package AppBundle\Controller\Api
 *
 * @Sensio\Route("/contacts")
 * @App\RestResult
 */
class ContactController extends RestController
{

    /**
     * @var ContactManager
     */
    protected $contactManager;

    /**
     * @DI\InjectParams({
     *     "contactManager" = @DI\Inject("api.manager.contact")
     * })
     *
     * @param ContactManager $contactManager
     */
    public function __construct(ContactManager $contactManager)
    {
        $this->contactManager = $contactManager;
    }

    /**
     * @ApiDoc(input = "AppBundle\Entity\Input\CreateContact", views = {"default", "admin"})
     *
     * @Sensio\Security("has_role('ROLE_USER')")
     * @Rest\Post("", name="api_post_contact")
     * @Sensio\ParamConverter("createContact", converter = "fos_rest.request_body")
     * @Rest\View(statusCode=201, serializerGroups={"default", "contact"})
{'fraction_non_alphanumeric': 0.12670765027322403, 'fraction_numerical': 0.0020491803278688526, 'mean_word_length': 4.15669014084507, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5445145', 'n_tokens_mistral': 876, 'n_tokens_neox': 861, 'n_words': 149}