<commit_before><?php
/**
 * This file is part of knocker project
 * Created by <NAME>
 * <EMAIL>
 */

namespace AppBundle\Controller;


use Application\Sonata\UserBundle\Document\User;
use FOS\RestBundle\Controller\FOSRestController;
use Symfony\Component\Routing\Annotation\Route;

/**
 * Class ApiController
 * @package AppBundle\Controller
 * @Route("/{apiKey}/api")
 */
class ApiController extends FOSRestController{

    /**
     * @param $userKey
     * @return mixed|void
     * @Route("/user/{userKey}")
     */
    public function getKnockerUser($userKey)
    {
        $user = new User();
        $user->setUsername($userKey);
        $view = $this
            ->view($user, 200)
            ->setFormat('json');

        return $this->handleView($view);
    }
} <commit_msg>add service in get-knocker-user action<commit_after><?php
/**
 * This file is part of knocker project
 * Created by <NAME>
 * <EMAIL>
 */

namespace AppBundle\Controller;


use Application\Sonata\UserBundle\Entity\User;
use FOS\RestBundle\Controller\FOSRestController;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\Routing\Annotation\Route;

/**
 * Class ApiController
 * @package AppBundle\Controller
 * @Route("/{apiKey}/api")
 */
class ApiController extends FOSRestController{

    /**
     * @param $userKey
     * @return mixed|void
     * @Route("/user/{userKey}")
     */
    public function getKnockerUser($userKey)
    {

        $user = $this->get('doctrine')->getRepository('ApplicationSonataUserBundle:User')->findOneBy(['userkey' => $userKey]);
        if (
            $user &&
            $user->isAccountNonExpired() &&
            $user->isAccountNonLocked() &&
            $user->isEnabled() &&
            $user->isCredentialsNonExpired()
        ) {
            $user->setRoles($this->get('app.knocker_role_builder')->getKnockerRoles($user->getId()));
            $view = $this
                ->view($user, 200)
                ->setFormat('json');
        } else {
            $view = $this->view();
        };

        return $this->handleView($view);
    }
} 
{'fraction_non_alphanumeric': 0.1524940617577197, 'fraction_numerical': 0.0028503562945368173, 'mean_word_length': 2.694736842105263, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 27, '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': '1357804', 'n_tokens_mistral': 636, 'n_tokens_neox': 627, 'n_words': 111}