mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 10:33:49 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -37,11 +37,8 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\FormFactoryInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use function count;
|
||||
|
||||
/**
|
||||
* Class EventController.
|
||||
*/
|
||||
@@ -90,7 +87,6 @@ class EventController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $event_id
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/delete", name="chill_event__event_delete", requirements={"event_id"="\d+"}, methods={"GET", "DELETE"})
|
||||
*/
|
||||
public function deleteAction($event_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||
@@ -109,7 +105,7 @@ class EventController extends AbstractController
|
||||
|
||||
$form = $this->createDeleteForm($event_id);
|
||||
|
||||
if ($request->getMethod() === Request::METHOD_DELETE) {
|
||||
if (Request::METHOD_DELETE === $request->getMethod()) {
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid()) {
|
||||
@@ -142,9 +138,8 @@ class EventController extends AbstractController
|
||||
/**
|
||||
* Displays a form to edit an existing Event entity.
|
||||
*
|
||||
* @param $event_id
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/edit", name="chill_event__event_edit")
|
||||
*/
|
||||
public function editAction($event_id)
|
||||
@@ -168,11 +163,10 @@ class EventController extends AbstractController
|
||||
/**
|
||||
* List events subscriptions for a person.
|
||||
*
|
||||
* @param $person_id
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{person_id}/list", name="chill_event__list_by_person", methods={"GET"})
|
||||
*/
|
||||
public function listByPersonAction($person_id)
|
||||
@@ -233,9 +227,8 @@ class EventController extends AbstractController
|
||||
/**
|
||||
* Displays a form to create a new Event entity.
|
||||
*
|
||||
* @param Center $center
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/new", name="chill_event__event_new", methods={"GET", "POST"})
|
||||
*/
|
||||
public function newAction(?Center $center, Request $request)
|
||||
@@ -270,6 +263,7 @@ class EventController extends AbstractController
|
||||
|
||||
/**
|
||||
* First step of new Event form.
|
||||
*
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/new/pick-center", name="chill_event__event_new_pickcenter", options={null})
|
||||
*/
|
||||
public function newPickCenterAction()
|
||||
@@ -281,7 +275,7 @@ class EventController extends AbstractController
|
||||
*/
|
||||
$centers = $this->authorizationHelper->getReachableCenters($this->getUser(), $role);
|
||||
|
||||
if (count($centers) === 1) {
|
||||
if (1 === \count($centers)) {
|
||||
return $this->redirectToRoute('chill_event__event_new', [
|
||||
'center_id' => $centers[0]->getId(),
|
||||
]);
|
||||
@@ -316,9 +310,10 @@ class EventController extends AbstractController
|
||||
*
|
||||
* @ParamConverter("event", options={"id": "event_id"})
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/show", name="chill_event__event_show")
|
||||
*/
|
||||
public function showAction(Event $event, Request $request)
|
||||
@@ -351,7 +346,6 @@ class EventController extends AbstractController
|
||||
/**
|
||||
* Edits an existing Event entity.
|
||||
*
|
||||
* @param $event_id
|
||||
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/update", name="chill_event__event_update", methods={"POST", "PUT"})
|
||||
*/
|
||||
public function updateAction(Request $request, $event_id): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||
@@ -493,9 +487,9 @@ class EventController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return Spreadsheet
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
protected function createExportSpreadsheet(Event $event)
|
||||
{
|
||||
@@ -527,14 +521,14 @@ class EventController extends AbstractController
|
||||
$columnLetter = 'A';
|
||||
|
||||
foreach ($columnNames as $columnName) {
|
||||
$sheet->setCellValue($columnLetter . '8', $columnName);
|
||||
$sheet->setCellValue($columnLetter.'8', $columnName);
|
||||
++$columnLetter;
|
||||
}
|
||||
|
||||
$columnValues = [];
|
||||
|
||||
foreach ($event->getParticipations() as $participation) {
|
||||
/** @var Participation $participation */
|
||||
/* @var Participation $participation */
|
||||
$columnValues[] = [
|
||||
$participation->getPerson()->getId(),
|
||||
$participation->getPerson()->getFirstname(),
|
||||
@@ -553,7 +547,7 @@ class EventController extends AbstractController
|
||||
$columnLetter = 'A';
|
||||
|
||||
foreach ($columnValue as $value) {
|
||||
$sheet->setCellValue($columnLetter . $i, $value);
|
||||
$sheet->setCellValue($columnLetter.$i, $value);
|
||||
++$columnLetter;
|
||||
}
|
||||
++$i;
|
||||
@@ -563,9 +557,9 @@ class EventController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Exception
|
||||
*/
|
||||
protected function exportParticipationsList(Event $event, Request $request)
|
||||
{
|
||||
@@ -575,7 +569,7 @@ class EventController extends AbstractController
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$data = $form->getData();
|
||||
$format = $data['format'];
|
||||
$filename = 'export_event' . $event->getId() . '_participations.' . $format;
|
||||
$filename = 'export_event'.$event->getId().'_participations.'.$format;
|
||||
|
||||
$spreadsheet = $this->createExportSpreadsheet($event);
|
||||
|
||||
@@ -604,7 +598,7 @@ class EventController extends AbstractController
|
||||
|
||||
$response = new StreamedResponse();
|
||||
$response->headers->set('Content-Type', $contentType);
|
||||
$response->headers->set('Content-Disposition', 'attachment;filename="' . $filename . '"');
|
||||
$response->headers->set('Content-Disposition', 'attachment;filename="'.$filename.'"');
|
||||
$response->setPrivate();
|
||||
$response->headers->addCacheControlDirective('no-cache', true);
|
||||
$response->headers->addCacheControlDirective('must-revalidate', true);
|
||||
@@ -639,8 +633,6 @@ class EventController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $event_id
|
||||
*
|
||||
* @return \Symfony\Component\Form\FormInterface
|
||||
*/
|
||||
private function createDeleteForm($event_id)
|
||||
|
Reference in New Issue
Block a user