Skip to content

Commit 5527450

Browse files
committed
Minor: Format code
1 parent 54bef79 commit 5527450

File tree

6 files changed

+21
-17
lines changed

6 files changed

+21
-17
lines changed

src/CoreBundle/Command/DeactivateUsersWithNoActiveSessionCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
4444
$now = new DateTime('now', new DateTimeZone('UTC'));
4545

4646
$io->title('Deactivating students without active sessions...');
47-
$io->text('Checking as of ' . $now->format('Y-m-d H:i:s'));
47+
$io->text('Checking as of '.$now->format('Y-m-d H:i:s'));
4848

4949
// Subquery: user IDs with at least one session where endDate > now OR endDate is null
5050
$subQb = $this->entityManager->createQueryBuilder();
@@ -56,7 +56,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5656
's.accessEndDate > :now',
5757
's.accessEndDate IS NULL'
5858
))
59-
->getDQL();
59+
->getDQL()
60+
;
6061

6162
// Main query: active students not in the subquery
6263
$qb = $this->entityManager->createQueryBuilder();
@@ -69,7 +70,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6970
->setParameter('now', $now, Types::DATETIME_MUTABLE)
7071
->setParameter('studentRole', 5)
7172
->getQuery()
72-
->getResult();
73+
->getResult()
74+
;
7375

7476
$deactivatedCount = 0;
7577

src/CoreBundle/Controller/Api/CLinkImageController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ public function __invoke(CLink $link, Request $request): Response
4747
$asset = new Asset();
4848
$asset->setFile($finalFile)
4949
->setCategory(Asset::LINK)
50-
->setTitle($file->getClientOriginalName());
50+
->setTitle($file->getClientOriginalName())
51+
;
5152

5253
$this->entityManager->persist($asset);
5354
$this->entityManager->flush();

src/CoreBundle/Controller/CertificateController.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
66

77
namespace Chamilo\CoreBundle\Controller;
88

9+
use Chamilo\CoreBundle\Framework\Container;
910
use Chamilo\CoreBundle\Repository\GradebookCertificateRepository;
1011
use Chamilo\CoreBundle\Settings\SettingsManager;
11-
use Chamilo\CoreBundle\Framework\Container;
1212
use Mpdf\Mpdf;
1313
use Mpdf\MpdfException;
1414
use Mpdf\Output\Destination;
15+
use RuntimeException;
1516
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1617
use Symfony\Component\HttpFoundation\Response;
17-
use Symfony\Component\Routing\Attribute\Route;
18-
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
1918
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
19+
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
20+
use Symfony\Component\Routing\Attribute\Route;
2021

2122
#[Route('/certificates')]
2223
class CertificateController extends AbstractController
@@ -30,7 +31,7 @@ public function __construct(
3031
public function view(string $hash): Response
3132
{
3233
// Build the expected certificate filename from the hash
33-
$filename = $hash . '.html';
34+
$filename = $hash.'.html';
3435

3536
// Look up the certificate record by its path
3637
$certificate = $this->certificateRepository->findOneBy([
@@ -60,15 +61,15 @@ public function view(string $hash): Response
6061
$content = str_replace(' media="screen"', '', $content);
6162

6263
// Return the certificate as a raw HTML response
63-
return new Response('<!DOCTYPE html>' . $content, 200, [
64+
return new Response('<!DOCTYPE html>'.$content, 200, [
6465
'Content-Type' => 'text/html; charset=UTF-8',
6566
]);
6667
}
6768

6869
#[Route('/{hash}.pdf', name: 'chamilo_certificate_public_pdf', methods: ['GET'])]
6970
public function downloadPdf(string $hash): Response
7071
{
71-
$filename = $hash . '.html';
72+
$filename = $hash.'.html';
7273

7374
$certificate = $this->certificateRepository->findOneBy(['pathCertificate' => $filename]);
7475
if (!$certificate) {
@@ -95,6 +96,7 @@ public function downloadPdf(string $hash): Response
9596
'tempDir' => api_get_path(SYS_ARCHIVE_PATH).'mpdf/',
9697
]);
9798
$mpdf->WriteHTML($html);
99+
98100
return new Response(
99101
$mpdf->Output('certificate.pdf', Destination::DOWNLOAD),
100102
200,
@@ -104,7 +106,7 @@ public function downloadPdf(string $hash): Response
104106
]
105107
);
106108
} catch (MpdfException $e) {
107-
throw new \RuntimeException('Failed to generate PDF: '.$e->getMessage(), 500, $e);
109+
throw new RuntimeException('Failed to generate PDF: '.$e->getMessage(), 500, $e);
108110
}
109111
}
110112
}

src/CoreBundle/EventListener/LoginSuccessHandler.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@
2121
use Chamilo\CoreBundle\Settings\SettingsManager;
2222
use DateTime;
2323
use Doctrine\ORM\EntityManagerInterface;
24+
use Exception;
2425
use Symfony\Component\HttpFoundation\RedirectResponse;
2526
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
26-
use Symfony\Component\Routing\RouterInterface;
2727
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
2828
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
29-
use UserManager;
3029

3130
class LoginSuccessHandler
3231
{
@@ -43,7 +42,7 @@ public function __construct(
4342
) {}
4443

4544
/**
46-
* @throws \Exception
45+
* @throws Exception
4746
*/
4847
public function __invoke(InteractiveLoginEvent $event): RedirectResponse
4948
{

src/CoreBundle/Repository/LegalRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ public function findOneByVersionAndLanguage(int $versionId, int $languageId): ?L
187187
'languageId' => $languageId,
188188
'versionId' => $versionId,
189189
])
190-
->setMaxResults(1);
190+
->setMaxResults(1)
191+
;
191192

192193
$result = $qb->getQuery()->getOneOrNullResult();
193194

src/CoreBundle/Repository/Node/CourseRepository.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Chamilo\CoreBundle\Repository\SessionRepository;
1919
use Doctrine\Common\Collections\Criteria;
2020
use Doctrine\ORM\AbstractQuery;
21-
use Doctrine\ORM\Exception\NotSupported;
2221
use Doctrine\ORM\Query\Expr\Join;
2322
use Doctrine\ORM\QueryBuilder;
2423
use Doctrine\Persistence\ManagerRegistry;
@@ -275,7 +274,7 @@ public function getPersonalSessionCourses(
275274
// Getting sessions that are related to a coach in the session_rel_course_rel_user table
276275
if ($isAllowedToCreateCourse) {
277276
$sessionListFromCourseCoach = array_map(
278-
fn(SessionRelCourseRelUser $srcru) => $srcru->getSession()->getId(),
277+
fn (SessionRelCourseRelUser $srcru) => $srcru->getSession()->getId(),
279278
$sessionCourseUserRepo->findBy(['user' => $user->getId(), 'status' => Session::COURSE_COACH])
280279
);
281280
}

0 commit comments

Comments
 (0)