<commit_before><?php
namespace App\Controller\Stations;

use App\Entity;
use App\Exception\StationUnsupportedException;
use App\Http\Response;
use App\Http\ServerRequest;
use App\Service\AzuraCastCentral;
use App\Session\Flash;
use Doctrine\ORM\EntityManager;
use Psr\Http\Message\ResponseInterface;

class StreamersController
{
    protected EntityManager $em;

    protected AzuraCastCentral $ac_central;

    protected Entity\Repository\SettingsRepository $settingsRepo;

    public function __construct(
        EntityManager $em,
        AzuraCastCentral $ac_central,
        Entity\Repository\SettingsRepository $settingsRepo
    ) {
        $this->em = $em;
        $this->ac_central = $ac_central;
        $this->settingsRepo = $settingsRepo;
        $this->csrf_namespace = 'stations_streamers';
    }

    public function __invoke(ServerRequest $request, Response $response): ResponseInterface
    {
        $station = $request->getStation();
        $backend = $request->getStationBackend();

        if (!$backend::supportsStreamers()) {
            throw new StationUnsupportedException;
        }

        $view = $request->getView();

        if (!$station->getEnableStreamers()) {
            $params = $request->getQueryParams();
            if (isset($params['enable'])) {
                $station->setEnableStreamers(true);
                $this->em->persist($station);
                $this->em->flush();

                $request->getFlash()->addMessage('<b>' . __('Streamers enabled!') . '</b><br>' . __('You can now set up streamer (DJ) accounts.'),<commit_msg>Minor fix to streamer controller.<commit_after><?php
namespace App\Controller\Stations;

use App\Entity;
use App\Exception\StationUnsupportedException;
use App\Http\Response;
use App\Http\ServerRequest;
use App\Service\AzuraCastCentral;
use App\Session\Flash;
use Doctrine\ORM\EntityManager;
use Psr\Http\Message\ResponseInterface;

class StreamersController
{
    protected EntityManager $em;

    protected AzuraCastCentral $ac_central;

    protected Entity\Repository\SettingsRepository $settingsRepo;

    public function __construct(
        EntityManager $em,
        AzuraCastCentral $ac_central,
        Entity\Repository\SettingsRepository $settingsRepo
    ) {
        $this->em = $em;
        $this->ac_central = $ac_central;
        $this->settingsRepo = $settingsRepo;
    }

    public function __invoke(ServerRequest $request, Response $response): ResponseInterface
    {
        $station = $request->getStation();
        $backend = $request->getStationBackend();

        if (!$backend::supportsStreamers()) {
            throw new StationUnsupportedException;
        }

        $view = $request->getView();

        if (!$station->getEnableStreamers()) {
            $params = $request->getQueryParams();
            if (isset($params['enable'])) {
                $station->setEnableStreamers(true);
                $this->em->persist($station);
                $this->em->flush();

                $request->getFlash()->addMessage('<b>' . __('Streamers enabled!') . '</b><br>' . __('You can now set up streamer (DJ) accounts.'),
{'fraction_non_alphanumeric': 0.12827058072750477, 'fraction_numerical': 0.0, 'mean_word_length': 3.0089514066496164, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 40, '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': '6015287', 'n_tokens_mistral': 876, 'n_tokens_neox': 851, 'n_words': 173}