<commit_before><?php

/*
 * This file is part of the Integrated package.
 *
 * (c) e-Active B.V. <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Integrated\Bundle\ContentBundle\Controller;

use Doctrine\ODM\MongoDB\DocumentManager;
use Integrated\Bundle\ContentBundle\Document\Channel\Channel;
use Integrated\Bundle\ContentBundle\Form\Type as Form;
use Integrated\Bundle\ContentBundle\Services\SearchContentReferenced;
use Integrated\Common\Channel\Event\ChannelEvent;
use Integrated\Common\Channel\Events;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

/**
 * Controller for CRUD actions Channel document.
 *
 * @author <NAME> <<EMAIL>>
 */
class ChannelController extends Controller
{
    /**
     * @var string
     */
    const CHANNEL_CLASS = 'Integrated\\Bundle\\ContentBundle\\Document\\Channel\\Channel';

    /**
     * @var DocumentManager
     */
    protected $documentManager;

    /**
     * @var SearchContentReferenced
     */
    protected $searchContentReferenced;

    /**
     * ChannelController constructor.
     *
     * @param DocumentManager         $documentManager
     * @param SearchContentReferenced $searchContentReferenced
     */
    public function __construct(DocumentManager $documentManager, SearchContentReferenced $searchContentReferenced)
    {
        $this->searchContentReferenced = $searchContentReferenced;
        $this->documentManager = $documentManager;
    }

    /**
     * Lists all the Channel documents.
     *
     * @return Response
     */
    public function indexAction()
    {
        if (!$this->isGranted('ROLE_CHANNEL_MANAGER') && !$this->isGranted('ROLE_ADMIN')) {
            throw $this->createAccessDeniedException();
        }

        $documents = $this->documentManager->getRepository(self::CHANNEL_CLASS)->findBy([], ['name' => 1]);

        return $this->render('IntegratedContentBundle:channel:index.html.twig', [
            'documents' => $documents,
        ]);
    }

    /**
     * Finds and displays a Channel document.<commit_msg>Fixed feedback<commit_after><?php

/*
 * This file is part of the Integrated package.
 *
 * (c) e-Active B.V. <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Integrated\Bundle\ContentBundle\Controller;

use Doctrine\ODM\MongoDB\DocumentManager;
use Integrated\Bundle\ContentBundle\Document\Channel\Channel;
use Integrated\Bundle\ContentBundle\Form\Type as Form;
use Integrated\Bundle\ContentBundle\Services\SearchContentReferenced;
use Integrated\Common\Channel\Event\ChannelEvent;
use Integrated\Common\Channel\Events;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

/**
 * Controller for CRUD actions Channel document.
 *
 * @author <NAME> <<EMAIL>>
 */
class ChannelController extends Controller
{
    /**
     * @var DocumentManager
     */
    protected $documentManager;

    /**
     * @var SearchContentReferenced
     */
    protected $searchContentReferenced;

    /**
     * ChannelController constructor.
     *
     * @param DocumentManager         $documentManager
     * @param SearchContentReferenced $searchContentReferenced
     */
    public function __construct(DocumentManager $documentManager, SearchContentReferenced $searchContentReferenced)
    {
        $this->searchContentReferenced = $searchContentReferenced;
        $this->documentManager = $documentManager;
    }

    /**
     * Lists all the Channel documents.
     *
     * @return Response
     */
    public function indexAction()
    {
        if (!$this->isGranted('ROLE_CHANNEL_MANAGER') && !$this->isGranted('ROLE_ADMIN')) {
            throw $this->createAccessDeniedException();
        }

        $documents = $this->documentManager->getRepository(Channel::class)->findBy([], ['name' => 1]);

        return $this->render('IntegratedContentBundle:channel:index.html.twig', [
            'documents' => $documents,
        ]);
    }

    /**
     * Finds and displays a Channel document.
{'fraction_non_alphanumeric': 0.1125302796740806, 'fraction_numerical': 0.0004404316229905307, 'mean_word_length': 3.5239043824701195, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 35, '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': '5904604', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1201, 'n_words': 257}