Skip to content

Commit 34d7e66

Browse files
committed
Minor: Format code
1 parent 08696ff commit 34d7e66

File tree

107 files changed

+637
-726
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+637
-726
lines changed

src/CoreBundle/Component/Editor/Toolbar.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ class Toolbar
1616
public array $defaultPlugins = [];
1717

1818
/**
19-
* Toolbar constructor.
20-
*
2119
* @param RouterInterface $urlGenerator
2220
* @param null $toolbar
2321
* @param array $config

src/CoreBundle/Component/Utils/AssetFileNameNamer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function name($object, PropertyMapping $mapping): string
4545
$titleSlug = $this->slugify($templateTitle);
4646
$extension = pathinfo($mapping->getFileName($object), PATHINFO_EXTENSION);
4747

48-
return sprintf('%s-%s.%s', $templateId, $titleSlug, $extension);
48+
return \sprintf('%s-%s.%s', $templateId, $titleSlug, $extension);
4949
}
5050
}
5151

src/CoreBundle/Component/Utils/ChamiloApi.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,22 @@ public static function getPlatformLogoPath(
9696
}
9797
}
9898
$themeDir = Template::getThemeDir($theme);
99-
$customLogoPath = $themeDir.sprintf('images/header-logo-custom%s.png', $accessUrlId);
99+
$customLogoPath = $themeDir.\sprintf('images/header-logo-custom%s.png', $accessUrlId);
100100

101101
$svgIcons = api_get_setting('icons_mode_svg');
102102
if ('true' === $svgIcons) {
103103
$customLogoPathSVG = substr($customLogoPath, 0, -3).'svg';
104-
if (file_exists(api_get_path(SYS_PUBLIC_PATH).sprintf('css/%s', $customLogoPathSVG))) {
104+
if (file_exists(api_get_path(SYS_PUBLIC_PATH).\sprintf('css/%s', $customLogoPathSVG))) {
105105
if ($getSysPath) {
106-
return api_get_path(SYS_PUBLIC_PATH).sprintf('css/%s', $customLogoPathSVG);
106+
return api_get_path(SYS_PUBLIC_PATH).\sprintf('css/%s', $customLogoPathSVG);
107107
}
108108

109109
return api_get_path(WEB_CSS_PATH).$customLogoPathSVG;
110110
}
111111
}
112-
if (file_exists(api_get_path(SYS_PUBLIC_PATH).sprintf('css/%s', $customLogoPath))) {
112+
if (file_exists(api_get_path(SYS_PUBLIC_PATH).\sprintf('css/%s', $customLogoPath))) {
113113
if ($getSysPath) {
114-
return api_get_path(SYS_PUBLIC_PATH).sprintf('css/%s', $customLogoPath);
114+
return api_get_path(SYS_PUBLIC_PATH).\sprintf('css/%s', $customLogoPath);
115115
}
116116

117117
return api_get_path(WEB_CSS_PATH).$customLogoPath;
@@ -310,10 +310,10 @@ public static function getEditorBlockStylePath(): string
310310
{
311311
$visualTheme = api_get_visual_theme();
312312

313-
$cssFile = api_get_path(SYS_CSS_PATH).sprintf('themes/%s/editor_content.css', $visualTheme);
313+
$cssFile = api_get_path(SYS_CSS_PATH).\sprintf('themes/%s/editor_content.css', $visualTheme);
314314

315315
if (is_file($cssFile)) {
316-
return api_get_path(WEB_CSS_PATH).sprintf('themes/%s/editor_content.css', $visualTheme);
316+
return api_get_path(WEB_CSS_PATH).\sprintf('themes/%s/editor_content.css', $visualTheme);
317317
}
318318

319319
return api_get_path(WEB_CSS_PATH).'editor_content.css';

src/CoreBundle/Controller/Admin/PluginsController.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,11 @@ public function pluginsAdd(): Response
3939
$allPluginsList = [];
4040
foreach ($allPlugins as $pluginName) {
4141
/*$file = api_get_path(SYS_PLUGIN_PATH).$pluginName.'/plugin.php';
42-
43-
if (is_file($file)) {
44-
$pluginInfo = require $file;
45-
var_dump($pluginInfo);exit;
46-
$allPluginsList[] = $pluginInfo;
47-
}*/
42+
* if (is_file($file)) {
43+
* $pluginInfo = require $file;
44+
* var_dump($pluginInfo);exit;
45+
* $allPluginsList[] = $pluginInfo;
46+
* }*/
4847
}
4948

5049
$installedPlugins = $appPlugin->getInstalledPlugins();

src/CoreBundle/Controller/Api/BaseResourceFileAction.php

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static function setLinks(AbstractResource $resource, EntityManagerInterfa
4949
$linkSet = true;
5050
$resourceLink->setCourse($course);
5151
} else {
52-
throw new InvalidArgumentException(sprintf('Course #%s does not exists', $link['cid']));
52+
throw new InvalidArgumentException(\sprintf('Course #%s does not exists', $link['cid']));
5353
}
5454
}
5555

@@ -59,7 +59,7 @@ public static function setLinks(AbstractResource $resource, EntityManagerInterfa
5959
$linkSet = true;
6060
$resourceLink->setSession($session);
6161
} else {
62-
throw new InvalidArgumentException(sprintf('Session #%s does not exists', $link['sid']));
62+
throw new InvalidArgumentException(\sprintf('Session #%s does not exists', $link['sid']));
6363
}
6464
}
6565

@@ -69,7 +69,7 @@ public static function setLinks(AbstractResource $resource, EntityManagerInterfa
6969
$linkSet = true;
7070
$resourceLink->setGroup($group);
7171
} else {
72-
throw new InvalidArgumentException(sprintf('Group #%s does not exists', $link['gid']));
72+
throw new InvalidArgumentException(\sprintf('Group #%s does not exists', $link['gid']));
7373
}
7474
}
7575

@@ -79,7 +79,7 @@ public static function setLinks(AbstractResource $resource, EntityManagerInterfa
7979
$linkSet = true;
8080
$resourceLink->setUser($user);
8181
} else {
82-
throw new InvalidArgumentException(sprintf('User #%s does not exists', $link['uid']));
82+
throw new InvalidArgumentException(\sprintf('User #%s does not exists', $link['uid']));
8383
}
8484
}
8585

@@ -104,25 +104,23 @@ public static function setLinks(AbstractResource $resource, EntityManagerInterfa
104104
// error_log('$resource->getResourceLinkEntityList()');
105105
foreach ($links as $link) {
106106
/*$rights = [];
107-
switch ($link->getVisibility()) {
108-
case ResourceLink::VISIBILITY_PENDING:
109-
case ResourceLink::VISIBILITY_DRAFT:
110-
$editorMask = ResourceNodeVoter::getEditorMask();
111-
$resourceRight = new ResourceRight();
112-
$resourceRight
113-
->setMask($editorMask)
114-
->setRole(ResourceNodeVoter::ROLE_CURRENT_COURSE_TEACHER)
115-
;
116-
$rights[] = $resourceRight;
117-
118-
break;
119-
}
120-
121-
if (!empty($rights)) {
122-
foreach ($rights as $right) {
123-
$link->addResourceRight($right);
124-
}
125-
}*/
107+
* switch ($link->getVisibility()) {
108+
* case ResourceLink::VISIBILITY_PENDING:
109+
* case ResourceLink::VISIBILITY_DRAFT:
110+
* $editorMask = ResourceNodeVoter::getEditorMask();
111+
* $resourceRight = new ResourceRight();
112+
* $resourceRight
113+
* ->setMask($editorMask)
114+
* ->setRole(ResourceNodeVoter::ROLE_CURRENT_COURSE_TEACHER)
115+
* ;
116+
* $rights[] = $resourceRight;
117+
* break;
118+
* }
119+
* if (!empty($rights)) {
120+
* foreach ($rights as $right) {
121+
* $link->addResourceRight($right);
122+
* }
123+
* }*/
126124
// error_log('link adding to node: '.$resource->getResourceNode()->getId());
127125
// error_log('link with user : '.$link->getUser()->getUsername());
128126
$resource->getResourceNode()->addResourceLink($link);

src/CoreBundle/Controller/AssetController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,6 @@ function () use ($stream): void {
7575
return $response;
7676
}
7777

78-
throw new FileNotFoundException(sprintf('File not found: %s', $path));
78+
throw new FileNotFoundException(\sprintf('File not found: %s', $path));
7979
}
8080
}

src/CoreBundle/Controller/CourseController.php

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -280,27 +280,22 @@ public function redirectTool(
280280
}
281281

282282
/*public function redirectToShortCut(string $toolName, CToolRepository $repo, ToolChain $toolChain): RedirectResponse
283-
{
284-
$tool = $repo->findOneBy([
285-
'name' => $toolName,
286-
]);
287-
288-
if (null === $tool) {
289-
throw new NotFoundHttpException($this->trans('Tool not found'));
290-
}
291-
292-
$tool = $toolChain->getToolFromName($tool->getTool()->getTitle());
293-
$link = $tool->getLink();
294-
295-
if (strpos($link, 'nodeId')) {
296-
$nodeId = (string) $this->getCourse()->getResourceNode()->getId();
297-
$link = str_replace(':nodeId', $nodeId, $link);
298-
}
299-
300-
$url = $link.'?'.$this->getCourseUrlQuery();
301-
302-
return $this->redirect($url);
303-
}*/
283+
* {
284+
* $tool = $repo->findOneBy([
285+
* 'name' => $toolName,
286+
* ]);
287+
* if (null === $tool) {
288+
* throw new NotFoundHttpException($this->trans('Tool not found'));
289+
* }
290+
* $tool = $toolChain->getToolFromName($tool->getTool()->getTitle());
291+
* $link = $tool->getLink();
292+
* if (strpos($link, 'nodeId')) {
293+
* $nodeId = (string) $this->getCourse()->getResourceNode()->getId();
294+
* $link = str_replace(':nodeId', $nodeId, $link);
295+
* }
296+
* $url = $link.'?'.$this->getCourseUrlQuery();
297+
* return $this->redirect($url);
298+
* }*/
304299

305300
/**
306301
* Edit configuration with given namespace.
@@ -376,7 +371,7 @@ public function about(
376371

377372
$courseValues = new ExtraFieldValue('course');
378373

379-
$urlCourse = api_get_path(WEB_PATH).sprintf('course/%s/about', $courseId);
374+
$urlCourse = api_get_path(WEB_PATH).\sprintf('course/%s/about', $courseId);
380375
$courseTeachers = $course->getTeachersSubscriptions();
381376
$teachersData = [];
382377

@@ -789,7 +784,7 @@ private function autoLaunch(): void
789784
// Redirecting to the LP
790785
$url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq();
791786
$_SESSION[$session_key] = true;
792-
header(sprintf('Location: %s', $url));
787+
header(\sprintf('Location: %s', $url));
793788

794789
exit;
795790
}
@@ -826,7 +821,7 @@ private function autoLaunch(): void
826821
'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp_data['iid'];
827822

828823
$_SESSION[$session_key] = true;
829-
header(sprintf('Location: %s', $url));
824+
header(\sprintf('Location: %s', $url));
830825

831826
exit;
832827
}
@@ -852,7 +847,7 @@ private function autoLaunch(): void
852847
}
853848
} else {
854849
$url = api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq();
855-
header(sprintf('Location: %s', $url));
850+
header(\sprintf('Location: %s', $url));
856851

857852
exit;
858853
}
@@ -870,7 +865,7 @@ private function autoLaunch(): void
870865
} else {
871866
// Redirecting to the document
872867
$url = api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq();
873-
header(sprintf('Location: %s', $url));
868+
header(\sprintf('Location: %s', $url));
874869

875870
exit;
876871
}
@@ -906,7 +901,7 @@ private function autoLaunch(): void
906901
$exerciseId = $row['iid'];
907902
$url = api_get_path(WEB_CODE_PATH).
908903
'exercise/overview.php?exerciseId='.$exerciseId.'&'.api_get_cidreq();
909-
header(sprintf('Location: %s', $url));
904+
header(\sprintf('Location: %s', $url));
910905

911906
exit;
912907
}

src/CoreBundle/Controller/ExceptionController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ public function show(Exception $exception): Response
2929
$format = 'html';
3030
$loader = $this->container->get('twig')->getLoader();
3131

32-
$templateToLoad = sprintf('@ChamiloCore/Exception/%s.html.twig', 'exception_full');
32+
$templateToLoad = \sprintf('@ChamiloCore/Exception/%s.html.twig', 'exception_full');
3333

3434
// when not in debug, try to find a template for the specific HTTP status code and format
35-
$template = sprintf('@ChamiloCore/Exception/%s%s.%s.twig', $name, $code, $format);
35+
$template = \sprintf('@ChamiloCore/Exception/%s%s.%s.twig', $name, $code, $format);
3636
if ($loader->exists($template)) {
3737
$templateToLoad = $template;
3838
}
3939

4040
// try to find a template for the given format
41-
$template = sprintf('@ChamiloCore/Exception/%s.%s.twig', $name, $format);
41+
$template = \sprintf('@ChamiloCore/Exception/%s.%s.twig', $name, $format);
4242
if ($loader->exists($template)) {
4343
$templateToLoad = $template;
4444
}
@@ -68,18 +68,18 @@ public function error(Request $request): Response
6868
$format = 'html';
6969
$loader = $this->container->get('twig')->getLoader();
7070

71-
$templateToLoad = sprintf('@ChamiloCore/Exception/%s.html.twig', 'exception_full');
71+
$templateToLoad = \sprintf('@ChamiloCore/Exception/%s.html.twig', 'exception_full');
7272

7373
// when not in debug, try to find a template for the specific HTTP status code and format
7474
// if (!$showException) {
75-
$template = sprintf('@ChamiloCore/Exception/%s%s.%s.twig', $name, $code, $format);
75+
$template = \sprintf('@ChamiloCore/Exception/%s%s.%s.twig', $name, $code, $format);
7676
if ($loader->exists($template)) {
7777
$templateToLoad = $template;
7878
}
7979
// }
8080

8181
// try to find a template for the given format
82-
$template = sprintf('@ChamiloCore/Exception/%s.%s.twig', $name, $format);
82+
$template = \sprintf('@ChamiloCore/Exception/%s.%s.twig', $name, $format);
8383
if ($loader->exists($template)) {
8484
$templateToLoad = $template;
8585
}

src/CoreBundle/Controller/ResetPasswordController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function reset(Request $request, UserPasswordHasherInterface $passwordHas
9797
try {
9898
$user = $this->resetPasswordHelper->validateTokenAndFetchUser($token);
9999
} catch (ResetPasswordExceptionInterface $e) {
100-
$this->addFlash('reset_password_error', sprintf(
100+
$this->addFlash('reset_password_error', \sprintf(
101101
'There was a problem validating your reset request - %s',
102102
$e->getReason()
103103
));

src/CoreBundle/Controller/ResourceController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public function download(Request $request, TrackEDownloadsRepository $trackEDown
256256
$qbAlias = $qb->getRootAliases()[0];
257257

258258
$qb
259-
->leftJoin(sprintf('%s.resourceFiles', $qbAlias), 'resourceFiles') // must have a file
259+
->leftJoin(\sprintf('%s.resourceFiles', $qbAlias), 'resourceFiles') // must have a file
260260
->addCriteria($criteria)
261261
;
262262

0 commit comments

Comments
 (0)